summaryrefslogtreecommitdiff
path: root/tests/basic
diff options
context:
space:
mode:
authorAnssi Kääriäinen <akaariai@gmail.com>2012-05-25 00:27:24 +0300
committerAnssi Kääriäinen <akaariai@gmail.com>2013-03-13 10:44:49 +0200
commitd3f00bd5706b35961390d3814dd7e322ead3a9a3 (patch)
treeff7bf1c1407fd0cca23288a698651e06e165761a /tests/basic
parentd744c550d51955fd623897884446b7f34318e94d (diff)
Refactored qs.add_q() and utils/tree.py
The sql/query.py add_q method did a lot of where/having tree hacking to get complex queries to work correctly. The logic was refactored so that it should be simpler to understand. The new logic should also produce leaner WHERE conditions. The changes cascade somewhat, as some other parts of Django (like add_filter() and WhereNode) expect boolean trees in certain format or they fail to work. So to fix the add_q() one must fix utils/tree.py, some things in add_filter(), WhereNode and so on. This commit also fixed add_filter to see negate clauses up the path. A query like .exclude(Q(reversefk__in=a_list)) didn't work similarly to .filter(~Q(reversefk__in=a_list)). The reason for this is that only the immediate parent negate clauses were seen by add_filter, and thus a tree like AND: (NOT AND: (AND: condition)) will not be handled correctly, as there is one intermediary AND node in the tree. The example tree is generated by .exclude(~Q(reversefk__in=a_list)). Still, aggregation lost connectors in OR cases, and F() objects and aggregates in same filter clause caused GROUP BY problems on some databases. Fixed #17600, fixed #13198, fixed #17025, fixed #17000, fixed #11293.
Diffstat (limited to 'tests/basic')
0 files changed, 0 insertions, 0 deletions