django1/django/contrib
Anssi Kääriäinen d3f00bd570 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.
2013-03-13 10:44:49 +02:00
..
admin Switched the admin to use @transaction.atomic. 2013-03-11 19:58:08 +01:00
admindocs Merged contrib translations from 1.5 branch 2013-02-26 21:51:06 +01:00
auth Switched the admin to use @transaction.atomic. 2013-03-11 19:58:08 +01:00
comments Deprecated django.contrib.comments. 2013-03-11 15:38:40 -05:00
contenttypes Fixed #15363 -- Renamed and normalized to `get_queryset` the methods that return a QuerySet. 2013-03-08 10:11:45 -05:00
flatpages Merged contrib translations from 1.5 branch 2013-02-26 21:51:06 +01:00
formtools Merged contrib translations from 1.5 branch 2013-02-26 21:51:06 +01:00
gis Refactored qs.add_q() and utils/tree.py 2013-03-13 10:44:49 +02:00
humanize Merged contrib translations from 1.5 branch 2013-02-26 21:51:06 +01:00
messages Merged contrib translations from 1.5 branch 2013-02-26 21:51:06 +01:00
redirects Merged contrib translations from 1.5 branch 2013-02-26 21:51:06 +01:00
sessions Deprecated transaction.commit/rollback_unless_managed. 2013-03-11 14:48:54 +01:00
sitemaps Fixed #19692 -- Completed deprecation of mimetype in favor of content_type. 2013-01-31 13:54:40 +01:00
sites Fixed #15363 -- Renamed and normalized to `get_queryset` the methods that return a QuerySet. 2013-03-08 10:11:45 -05:00
staticfiles Fixed #19526 2013-02-23 23:05:22 +01:00
syndication Test case and docs for custom context data in feeds 2013-02-24 08:33:20 -06:00
webdesign Fixed #18269 -- Applied unicode_literals for Python 3 compatibility. 2012-06-07 18:08:47 +02:00
__init__.py Created django.contrib and moved comments into it 2005-07-14 18:20:03 +00:00