Commit Graph

5 Commits

Author SHA1 Message Date
Hasan Ramezani c1cfec6b50 [3.0.x] Fixed #30854 -- Fixed QuerySet.select_related() with multiple FilteredRelations.
Backport of 6a75cea76a from master.
2019-10-11 09:18:23 +02:00
Rob 6b736dd074 Fixed #30349 -- Fixed QuerySet.exclude() on FilteredRelation.
Using annotated FilteredRelations raised a FieldError when coupled with
exclude(). This is due to not passing filtered relation fields to the
subquery created in split_exclude(). We fixed this issue by passing the
filtered relation data to the newly created subquery.

Secondly, in the case where an INNER JOIN is used in the excluded
subquery, the ORM would trim the filtered relation INNER JOIN in attempt
to simplify the query. This will also remove the ON clause filters
generated by the FilteredRelation. We added logic to not trim the INNER
JOIN if it is from FilteredRelation.
2019-05-07 14:47:50 +02:00
can c00b4dbda2 Fixed #29810 -- Fixed crash of select_related() on FilteredRelation with empty result. 2019-04-23 13:48:33 +02:00
Ran Benita 03049fb8d9 Refs #28010 -- Allowed reverse related fields in SELECT FOR UPDATE .. OF.
Thanks Adam Chidlow for polishing the patch.
2017-10-28 20:33:42 -04:00
Nicolas Delaby 01d440fa1e Fixed #27332 -- Added FilteredRelation API for conditional join (ON clause) support.
Thanks Anssi Kääriäinen for contributing to the patch.
2017-09-22 11:53:17 -04:00