Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/django/db/models/query_utils.py
Commit message (Collapse)AuthorAgeFilesLines
* Fixed #25611 -- Standardized descriptor signatures.Tim Graham2015-10-261-1/+1
|
* Fixed #25563 -- Cached deferred models in their proxied ↵Simon Charette2015-10-201-4/+5
| | | | | | model's _meta.apps. Thanks to Andriy Sokolovskiy for the report and Tim Graham for the review.
* Removed obsolete (since Python 2.3) ↵Tim Graham2015-10-051-5/+0
| | | | __safe_for_unpickling__ attribute.
* Fixed #24629 -- Unified Transform and Expression APIsJosh Smeaton2015-09-211-0/+55
|
* Fixed #23791 -- Corrected object type check for pk__in=qsAnssi Kääriäinen2015-06-291-0/+28
| | | | | | | | | | | | When the pk was a relation field, qs.filter(pk__in=qs) didn't work. In addition, fixed Restaurant.objects.filter(place=restaurant_instance), where place is an OneToOneField and the primary key of Restaurant. A big thank you to Josh for review and to Tim for review and cosmetic edits. Thanks to Beauhurst for commissioning the work on this ticket.
* Fixed #24924 -- Join promotion for multiple Case expressionsMark Lavin2015-06-051-3/+1
|
* Fixed #24705 -- Fixed negated Q objects in expressions.Anssi Kääriäinen2015-05-201-1/+1
| | | | Avoided split_exclude() for Q when used as an expression.
* Removed redundant list() calls.Tim Graham2015-05-161-1/+1
|
* Fixed #24766 -- Added join promotion for Case expressionsAnssi Kääriäinen2015-05-111-1/+6
|
* Removed cases of six.iter* wrapped in a list()Curtis Maloney2015-04-181-2/+2
| | | | | There's absolutely no advantage [and a mild performance hit] to using six.iter* in these cases.
* Renamed Field.rel attribute to remote_fieldAnssi Kääriäinen2015-03-251-2/+2
| | | | | | | | Field.rel is now deprecated. Rel objects have now also remote_field attribute. This means that self == self.remote_field.remote_field. In addition, made the Rel objects a bit more like Field objects. Still, marked ManyToManyFields as null=True.
* Refs #24267 -- Implemented lookups for related fieldsAnssi Kääriäinen2015-03-251-1/+15
| | | | | | | | | | Previously related fields didn't implement get_lookup, instead related fields were treated specially. This commit removed some of the special handling. In particular, related fields return Lookup instances now, too. Other notable changes in this commit is removal of support for annotations in names_to_path().
* Sorted imports with isort; refs #23860.Tim Graham2015-02-061-3/+1
|
* Fixed #24268 -- removed Query.havingAnssi Kääriäinen2015-02-041-0/+2
| | | | | | | Instead of splitting filter clauses to where and having parts before adding them to query.where or query.having, add all filter clauses to query.where, and when compiling the query split the where to having and where parts.
* Replaced inner functions by class methods.Simon Charette2015-01-151-12/+14
| | | | | | refs #24031 Thanks to Tim Graham and Michał Modzelewski for the review.
* Fixed #24031 -- Added CASE expressions to the ORM.Michał Modzelewski2015-01-131-0/+21
|
* Fixed #24020 -- Refactored SQL compiler to use expressionsAnssi Kääriäinen2015-01-081-1/+1
| | | | | | | | | | | | | | | Refactored compiler SELECT, GROUP BY and ORDER BY generation. While there, also refactored select_related() implementation (get_cached_row() and get_klass_info() are now gone!). Made get_db_converters() method work on expressions instead of internal_type. This allows the backend converters to target specific expressions if need be. Added query.context, this can be used to set per-query state. Also changed the signature of database converters. They now accept context as an argument.
* Fixed #12663 -- Formalized the Model._meta API for ↵Daniel Pyrathon2015-01-071-2/+2
| | | | | | | retrieving fields. Thanks to Russell Keith-Magee for mentoring this Google Summer of Code 2014 project and everyone else who helped with the patch!
* Fixed #9104 -- Moved FieldDoesNotExist to core.exceptionsDaniel Pyrathon2015-01-021-1/+1
|
* Fixed #21414 -- Removed RelatedObject and deprecated ↵Anssi Kääriäinen2014-12-231-0/+8
| | | | Field.related.
* Fixed #23968 -- Replaced list comprehension with ↵Jon Dufresne2014-12-081-1/+1
| | | | generators and dict comprehension
* Fixed #901 -- Added Model.refresh_from_db() methodAnssi Kääriäinen2014-11-281-8/+2
| | | | | Thanks to github aliases dbrgn, carljm, slurms, dfunckt, and timgraham for reviews.
* Renamed qn to compilerJosh Smeaton2014-11-161-1/+1
|
* Fixed #14030 -- Allowed annotations to accept all ↵Josh Smeaton2014-11-151-0/+15
| | | | expressions
* Avoided creation of deferred model from another deferred ↵Anssi Kääriäinen2014-08-121-0/+8
| | | | | | model Also never create deferred model when no attrs are deferred.
* Fixed many typos in comments and docstrings.Rodolfo Carvalho2014-03-031-1/+1
| | | | Thanks Piotr Kasprzyk for help with the patch.
* Fixed #21711 -- Enforced unicity of model names.Aymeric Augustin2014-01-051-10/+17
|
* Renamed AppCache to Apps.Aymeric Augustin2013-12-241-3/+3
| | | | | | Also renamed app_cache to apps and "app cache" to "app registry". Deprecated AppCache.app_cache_ready() in favor of Apps.ready().
* Fixed #17627 -- Renamed util.py files to utils.pyTim Graham2013-09-161-2/+2
| | | | | Thanks PaulM for the suggestion and Luke Granger-Brown and Wiktor Kołodziej for the initial patch.
* A large number of stylistic cleanups across django/db/Alex Gaynor2013-07-081-2/+4
|
* Converted a list comprehension into a generator ↵Adrian Holovaty2013-04-251-1/+1
| | | | expression in query_utils.py
* Negligible formatting fixes in query_utils.pyAdrian Holovaty2013-04-251-3/+2
|
* Refactored qs.add_q() and utils/tree.pyAnssi Kääriäinen2013-03-131-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 #17260 -- Added time zone aware aggregation and ↵Aymeric Augustin2013-02-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lookups. Thanks Carl Meyer for the review. Squashed commit of the following: commit 4f290bdb60b7d8534abf4ca901bd0844612dcbda Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Wed Feb 13 21:21:30 2013 +0100 Used '0:00' instead of 'UTC' which doesn't always exist in Oracle. Thanks Ian Kelly for the suggestion. commit 01b6366f3ce67d57a58ca8f25e5be77911748638 Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Wed Feb 13 13:38:43 2013 +0100 Made tzname a parameter of datetime_extract/trunc_sql. This is required to work around a bug in Oracle. commit 924a144ef8a80ba4daeeafbe9efaa826566e9d02 Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Wed Feb 13 14:47:44 2013 +0100 Added support for parameters in SELECT clauses. commit b4351d2890cd1090d3ff2d203fe148937324c935 Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Mon Feb 11 22:30:22 2013 +0100 Documented backwards incompatibilities in the two previous commits. commit 91ef84713c81bd455f559dacf790e586d08cacb9 Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Mon Feb 11 09:42:31 2013 +0100 Used QuerySet.datetimes for the admin's date_hierarchy. commit 0d0de288a5210fa106cd4350961eb2006535cc5c Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Mon Feb 11 09:29:38 2013 +0100 Used QuerySet.datetimes in date-based generic views. commit 9c0859ff7c0b00734afe7fc15609d43d83215072 Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sun Feb 10 21:43:25 2013 +0100 Implemented QuerySet.datetimes on Oracle. commit 68ab511a4ffbd2b811bf5da174d47e4dd90f28fc Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sun Feb 10 21:43:14 2013 +0100 Implemented QuerySet.datetimes on MySQL. commit 22d52681d347a8cdf568dc31ed032cbc61d049ef Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sun Feb 10 21:42:29 2013 +0100 Implemented QuerySet.datetimes on SQLite. commit f6800fd04c93722b45f9236976389e0b2fe436f5 Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sun Feb 10 21:43:03 2013 +0100 Implemented QuerySet.datetimes on PostgreSQL. commit 0c829c23f4cf4d6804cadcc93032dd4c26b8c65e Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sun Feb 10 21:41:08 2013 +0100 Added datetime-handling infrastructure in the ORM layers. commit 104d82a7778cf3f0f5d03dfa53709c26df45daad Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Mon Feb 11 10:05:55 2013 +0100 Updated null_queries tests to avoid clashing with the __second lookup. commit c01bbb32358201b3ac8cb4291ef87b7612a2b8e6 Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sun Feb 10 23:07:41 2013 +0100 Updated tests of .dates(). Replaced .dates() by .datetimes() for DateTimeFields. Replaced dates with datetimes in the expected output for DateFields. commit 50fb7a52462fecf0127b38e7f3df322aeb287c43 Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sun Feb 10 21:40:09 2013 +0100 Updated and added tests for QuerySet.datetimes. commit a8451a5004c437190e264667b1e6fb8acc3c1eeb Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sun Feb 10 22:34:46 2013 +0100 Documented the new time lookups and updated the date lookups. commit 29413eab2bd1d5e004598900c0dadc0521bbf4d3 Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sun Feb 10 16:15:49 2013 +0100 Documented QuerySet.datetimes and updated QuerySet.dates.
* [py3] Fixed access to dict keys/values/items.Aymeric Augustin2012-08-071-2/+3
|
* Fixed #17485 -- Made defer work with select_relatedAnssi Kääriäinen2012-06-261-2/+11
| | | | | | | | | | | | This commit tackles a couple of issues. First, in certain cases there were some mixups if field.attname or field.name should be deferred. Field.attname is now always used. Another issue tackled is a case where field is both deferred by .only(), and selected by select_related. This case is now an error. A lot of thanks to koniiiik (Michal Petrucha) for the patch, and to Andrei Antoukh for review.
* Fixed #18463 -- Forced type() argument to be a byte stringClaude Paroz2012-06-111-1/+2
|
* Fixed #18343 -- Cleaned up deferred model implementationAnssi Kääriäinen2012-05-271-17/+32
| | | | | | | | | | Generic cleanup and dead code removal in deferred model field loading and model.__reduce__(). Also fixed an issue where if an inherited model with a parent field chain parent_ptr_id -> id would be deferred loaded, then accessing the id field caused caused a database query, even if the id field's value is already loaded in the parent_ptr_id field.
* Fixed #16225 -- Removed unused imports. Many thanks to ↵Jannis Leidel2011-07-131-1/+0
| | | | | | Aymeric Augustin for the work on the patch and Alex for reviewing. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16539 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* Removed a bunch more Python 2.4 workarounds now that we ↵Adrian Holovaty2011-03-281-1/+0
| | | | | | 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 #7539, #13067 -- Added on_delete argument to ↵Carl Meyer2010-11-091-108/+0
| | | | | | ForeignKey to control cascade behavior. Also refactored deletion for efficiency and code clarity. Many thanks to Johannes Dollinger and Michael Glassford for extensive work on the patch, and to Alex Gaynor, Russell Keith-Magee, and Jacob Kaplan-Moss for review. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14507 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* Fixed #13827 -- Cleaned up a few unnecessary function calls.Jannis Leidel2010-09-261-3/+2
| | | | git-svn-id: http://code.djangoproject.com/svn/django/trunk@13876 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* Changed the way we create class names for deferred field ↵Malcolm Tredinnick2010-09-131-2/+4
| | | | | | | | | models to avoid problems when people have hundreds of fields on model. Maximum class name length is now 80 characters and uses a hash when necessary. git-svn-id: http://code.djangoproject.com/svn/django/trunk@13819 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* Fixed #13227 -- Modified ForeignKeys to fully honor the ↵Russell Keith-Magee2010-03-271-2/+4
| | | | | | db_prep/prep separation introduced by multidb. This was required to ensure that model instances aren't deepcopied as a result of being involved in a filter clause. Thanks to claudep for the report, and Alex Gaynor for the help on the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12865 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* Fixed #6191, #11296 -- Modified the admin deletion ↵Russell Keith-Magee2010-02-261-1/+3
| | | | | | confirmation page to use the same object collection scheme as the actual deletion. This ensures that all objects that may be deleted are actually deleted, and that cyclic display problems are avoided. Thanks to carljm for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12598 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* Fixed #12734. Deferred fields will now be properly ↵Joseph Kocherhans2010-02-241-1/+19
| | | | | | converted to python when accessed. Thanks, Alex Gaynor. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12579 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* Fixed #7270 -- Added the ability to follow reverse ↵Russell Keith-Magee2010-01-271-4/+14
| | | | | | OneToOneFields in select_related(). Thanks to George Vilches, Ben Davis, and Alex Gaynor for their work on various stages of this patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12307 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* Fixed #1142 -- Added multiple database support.Russell Keith-Magee2009-12-221-2/+2
| | | | | | | | | | | | | | | | | This monster of a patch is the result of Alex Gaynor's 2009 Google Summer of Code project. Congratulations to Alex for a job well done. Big thanks also go to: * Justin Bronn for keeping GIS in line with the changes, * Karen Tracey and Jani Tiainen for their help testing Oracle support * Brett Hoerner, Jon Loyens, and Craig Kimmerer for their feedback. * Malcolm Treddinick for his guidance during the GSoC submission process. * Simon Willison for driving the original design process * Cal Henderson for complaining about ponies he wanted. ... and everyone else too numerous to mention that helped to bring this feature into fruition. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11952 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* Fixed #11863: added a `Model.objects.raw()` method for ↵Jacob Kaplan-Moss2009-12-201-0/+7
| | | | | | | | | | executing raw SQL queries and yield models. See `docs/topics/db/raw.txt` for details. Thanks to seanoc for getting the ball rolling, and to Russ for wrapping things up. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11921 bcc190cf-cafb-0310-a4f2-bffc1f526a37
* Fixed #11753 - Q objects with callables no longer ↵Jacob Kaplan-Moss2009-12-171-6/+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