Select_related filters objects with no related member
|Reported by:||Owned by:||Aymeric Augustin|
|Component:||Database layer (models, ORM)||Version:||1.5-beta-1|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
In Django <=1.4 if you used select_related and the related object doesn't exist, it would be filled in as None, but the original object would still show up in the results.
In Django 1.5, not having a related object when using select_related results in the original object not existing when calling get() or indexing it.
Note that the SQL is still the proper LEFT OUTER JOIN. Furthermore, a count() will result in the proper expected number of objects.
Change History (11)
comment:1 Changed 4 years ago by
|Patch needs improvement:||unset|
|Severity:||Normal → Release blocker|
|Status:||new → closed|
|Triage Stage:||Unreviewed → Accepted|
comment:7 Changed 4 years ago by
|Owner:||changed from nobody to Aymeric Augustin|
|Status:||new → assigned|