Please sign in to comment.
Fixed #17485 -- Made defer work with select_related
This commit tackles a couple of issues. First, in certain cases there were some mixups if field.attname or field.name should be deferred. Field.attname is now always used. Another issue tackled is a case where field is both deferred by .only(), and selected by select_related. This case is now an error. A lot of thanks to koniiiik (Michal Petrucha) for the patch, and to Andrei Antoukh for review.
- Loading branch information...
Showing with 81 additions and 21 deletions.
- +4 −3 django/db/models/query.py
- +11 −2 django/db/models/query_utils.py
- +5 −2 django/db/models/sql/compiler.py
- +9 −3 django/db/models/sql/query.py
- +8 −3 docs/ref/models/querysets.txt
- +15 −5 tests/modeltests/defer/tests.py
- +4 −0 tests/regressiontests/defer_regress/models.py
- +24 −2 tests/regressiontests/defer_regress/tests.py
- +1 −1 tests/regressiontests/select_related_regress/tests.py