Branch: refs/heads/master
Home: https://github.com/django/django
Commit: d3f00bd5706b35961390d3814dd7e322ead3a9a3
https://github.com/django/django/commit/d3f00bd5706b35961390d3814dd7e322ead3a9a3
Author: Anssi Kääriäinen <[email protected]>
Date: 2013-03-13 (Wed, 13 Mar 2013)
Changed paths:
M django/contrib/gis/db/models/sql/where.py
M django/db/models/aggregates.py
M django/db/models/constants.py
M django/db/models/expressions.py
M django/db/models/query_utils.py
M django/db/models/sql/compiler.py
M django/db/models/sql/expressions.py
M django/db/models/sql/query.py
M django/db/models/sql/subqueries.py
M django/db/models/sql/where.py
M django/utils/tree.py
M tests/aggregation_regress/tests.py
M tests/queries/models.py
M tests/queries/tests.py
Log Message:
-----------
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.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.