Skip to content

Commit

Permalink
Merge pull request #91 from pmg-certn/docs/rename-age-pair-to-age
Browse files Browse the repository at this point in the history
Rename `age_pair` to `age` to use more standard readers naming convention
  • Loading branch information
j4mie authored Dec 20, 2023
2 parents d4c26e0 + f3a0109 commit c35ad64
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit c35ad64

Please sign in to comment.