dabapps / django-readers

A lightweight function-oriented toolkit for better organisation of business logic and efficient selection and projection of data in Django projects.
https://www.django-readers.org
BSD 2-Clause "Simplified" License
183 stars 7 forks source link

Add example to docs for aliasing a relationship #101

Closed pmg-certn closed 4 weeks ago

pmg-certn commented 1 month ago

Docs only give the mechanism for aliasing a field:

image

It would be good to describe the mechanism for aliasing a nested relationship, especially as its slightly 'odd' (requiring nesting the relationship):

spec = [
    {
        "read_books": {
            "book_set": [
                 pairs.filter(is_read=True),
                 "title"
            ]
        }
    }
]