Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/django/utils/tree.py
Commit message (Collapse)AuthorAgeFilesLines
* Removed legacy ORM lookup support per deprecation ↵Tim Graham2015-01-191-8/+0
| | | | timeline; refs #16187.
* Fixed #23968 -- Replaced list comprehension with ↵Jon Dufresne2014-12-081-4/+4
| | | | generators and dict comprehension
* Fixed #22531 -- Added tree.Node.__repr__ and tests for ↵Moayad Mardini2014-05-161-0/+3
| | | | | | | | | | the class. While Node class has a useful `__str__`, its `__repr__` is not that useful. Added a `__repr__` that makes use of the current `__str__`. This is especially useful since the more popular `Q` class inherits `tree.Node`. Also created new tests that cover most of `Node` class functionality.
* Use `classmethod` as a decorator.xuxiang2013-11-201-1/+1
|
* More attacking E302 violatorsAlex Gaynor2013-11-021-0/+1
|
* Replaced an antiquated pattern.Aymeric Augustin2013-05-171-1/+1
| | | | Thanks Lennart Regebro for pointing it out.
* Refactored qs.add_q() and utils/tree.pyAnssi Kääriäinen2013-03-131-66/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fixed #18963 -- Used a subclass-friendly patternAymeric Augustin2012-11-031-1/+3
| | | | for Python 2 object model compatibility methods.
* Revert "Fixed #16211 -- Added comparison and negation ↵Anssi Kääriäinen2012-10-101-6/+2
| | | | | | | | | | ops to F() expressions" This reverts commit 28abf5f0ebc9d380f25dd278d7ef4642c4504545. Conflicts: docs/releases/1.5.txt
* Fixed #16211 -- Added comparison and negation ops to F() ↵Anssi Kääriäinen2012-09-301-2/+6
| | | | | | | expressions Work done by Walter Doekes and Trac alias knoeb. Reviewed by Simon Charette.
* [py3] Replaced __nonzero__ by __bool__Claude Paroz2012-08-081-1/+2
| | | | Of course, __nonzero__ alias has been kept for Python 2 compatibility.
* Removed a bunch more Python 2.4 workarounds now that we ↵Adrian Holovaty2011-03-281-3/+3
| | | | | | don't support that version. Refs #15702 -- thanks to jonash for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@15927 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* Fixed #11753 - Q objects with callables no longer ↵Jacob Kaplan-Moss2009-12-171-1/+1
| | | | | | explode on Python 2.4. Thanks, Jeremy Dunck. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11901 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* Fixed #8283 -- Fixed an edge case when adding things to ↵Malcolm Tredinnick2008-08-161-1/+1
| | | | | | | | | the "where" tree and combining different connector types. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8413 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* Redo the changes in [7773] in a better way.Malcolm Tredinnick2008-07-041-6/+25
| | | | | | | | | | This removes some of the leaky abstraction problems (lifting WhereNode internals into the Query class) from that commit and makes it possible for extensions to WhereNode to have access to the field instances. It's also backwards-compatible with pre-[7773] code, which is also better. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7835 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* Merged the queryset-refactor branch into trunk.Malcolm Tredinnick2008-04-271-0/+134
This is a big internal change, but mostly backwards compatible with existing code. Also adds a couple of new features. Fixed #245, #1050, #1656, #1801, #2076, #2091, #2150, #2253, #2306, #2400, #2430, #2482, #2496, #2676, #2737, #2874, #2902, #2939, #3037, #3141, #3288, #3440, #3592, #3739, #4088, #4260, #4289, #4306, #4358, #4464, #4510, #4858, #5012, #5020, #5261, #5295, #5321, #5324, #5325, #5555, #5707, #5796, #5817, #5987, #6018, #6074, #6088, #6154, #6177, #6180, #6203, #6658 git-svn-id: http://code.djangoproject.com/svn/django/trunk@7477 bcc190cf-cafb-0310-a4f2-bffc1f526a37