Skip to content

Rename age_pair to age to use more standard readers naming convention #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/explanation.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ Note above that the second argument to `producers.relationship` is a projector f
In the example used above, the `produce_age` producer depends on the `birth_year` field:

```python
age_pair = (qs.include_fields("birth_year"), produce_age)
age = (qs.include_fields("birth_year"), produce_age)
```

`django-readers` includes [some useful functions that create pairs](reference/pairs.md). These attempt to generate the most efficient queries they can, which means loading only those database fields required to produce the value or values:
Expand Down Expand Up @@ -199,7 +199,7 @@ Relationships can automatically be loaded and projected, too:
```python
prepare, project = pairs.combine(
pairs.producer_to_projector("name", pairs.field("name")),
pairs.producer_to_projector("age", age_pair),
pairs.producer_to_projector("age", age),
pairs.producer_to_projector(
"book_set",
pairs.relationship(
Expand Down Expand Up @@ -234,7 +234,7 @@ from django_readers import specs

spec = [
"name",
{"age": age_pair},
{"age": age},
{
"book_set": [
"title",
Expand Down