summaryrefslogtreecommitdiff
path: root/django/db/models
AgeCommit message (Collapse)Author
2013-03-06Fixed #19989 -- Suppressed UnicodeWarning during BinaryField validationClaude Paroz
Thanks Aymeric Augustin for the report and Simon Charette for the review.
2013-03-02Added support for serializing BinaryFieldClaude Paroz
2013-03-02Add a BinaryField model fieldClaude Paroz
Thanks Michael Jung, Charl Botha and Florian Apolloner for review and help on the patch.
2013-02-28Fixed #19929 -- Improved error when MySQL doesn't have TZ definitions.Aymeric Augustin
Thanks tomas_00 for the report.
2013-02-28Fixed #12823 -- Was already fixed in master, tests addedAnssi Kääriäinen
Also added a little improvement to sql/query.py to get rid of non-necessary IS NOT NULL check.
2013-02-27Fixed #19861 -- Transaction ._dirty flag improvementAnssi Kääriäinen
There were a couple of errors in ._dirty flag handling: * It started as None, but was never reset to None. * The _dirty flag was sometimes used to indicate if the connection was inside transaction management, but this was not done consistently. This also meant the flag had three separate values. * The None value had a special meaning, causing for example inability to commit() on new connection unless enter/leave tx management was done. * The _dirty was tracking "connection in transaction" state, but only in managed transactions. * Some tests never reset the transaction state of the used connection. * And some additional less important changes. This commit has some potential for regressions, but as the above list shows, the current situation isn't perfect either.
2013-02-25Fixed #19634 -- Added proper __hash__ methods.Aymeric Augustin
Classes overriding __eq__ need a __hash__ such that equal objects have the same hash. Thanks akaariai for the report and regebro for the patch.
2013-02-24Fixed #19688 -- Allow model subclassing with a custom metaclass using ↵Simon Charette
six.with_metaclass
2013-02-24Revert "fixes #19263" - Fails if not SQLiteHonza Kral
This reverts commit 2b76f19f2b89ac96bae2a169d71b23553c8101c7.
2013-02-23Merge pull request #813 from HiddenData/ticket-19263Honza Král
fixes #19263 - EmptyResultSet in subquery causes incorrect SQL
2013-02-23fixes #19263Marcin Biernat
2013-02-23Merge pull request #804 from oinopion/ticket18162Honza Král
Fixes #18162 -- Specifying choices to Field overrides any form_class argument
2013-02-23Fixed 19895 -- Made second iteration over invalid queryset raise an ↵Grzegorz Nosek
exception too When iteration over a queryset raised an exception, the result cache remained initialized with an empty list, so subsequent iterations returned an empty list instead of raising an exception
2013-02-23Proposed fix for #18162.Tomek Paczkowski
2013-02-23Fixed #19816: pre-evaluate queryset on m2m setTomek Paczkowski
In ReverseManyRelatedObjectsDescriptor.__set__, evaluate possible queryset to avoid problems when clear() would touch data this queryset returns.
2013-02-23Fixed empty strings + to_field regression on OracleAnssi Kääriäinen
Querying the reverse side of nullable to_field relation, where both sides can contain null values resulted in incorrect results. The reason was not detecting '' as NULL. Refs #17541
2013-02-21Fixed #19870 -- Regression in select_related in inheritance casesAnssi Kääriäinen
There was a regression in case two models inherited the same parent, and one contained a foreign key to other. When select_related travelled the foreign key the other model reused the parent join made by the first model. This was likely caused by Query.join_parent_model() addition in commit 68985db48212c701a3d975636123a5d79bdc006f. Thanks to Trac alias loic84 for report & tests.
2013-02-20Cleaned up join promotion in query.combine() with ORAnssi Kääriäinen
Refs #19849
2013-02-20Removed join() promote kwargAnssi Kääriäinen
The join promote=True was over-aggressive in select_related handling. After that was removed, the only other user was query.combine(). That use case is very easy to handle locally, so there is no more need for the join(promote=True) flag. Refs #19849.
2013-02-20Refactored negated IS NULL handlingAnssi Kääriäinen
This one cleaned up add_filter() negated filter generation. As a side effect split_exclude() was cleaned up, too. Refs #19849
2013-02-20Added a db_constraint option to ForeignKeys.Alex Gaynor
This controls whether or not a database level cosntraint is created. This is useful in a few specialized circumstances, but in general should not be used!
2013-02-19Fixed #19837 -- Refactored split_exclude() join generationAnssi Kääriäinen
The refactoring mainly concentrates on making sure the inner and outer query agree about the split position. The split position is where the multijoin happens, and thus the split position also determines the columns used in the "WHERE col1 IN (SELECT col2 from ...)" condition. This commit fixes a regression caused by #10790 and commit 69597e5bcc89aadafd1b76abf7efab30ee0b8b1a. The regression was caused by wrong cols in the split position.
2013-02-16Fixed #17260 -- Added time zone aware aggregation and lookups.Aymeric Augustin
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.
2013-02-11Added a check in the creation of IS NULL clauses.Aymeric Augustin
value_annotation isn't very well defined. Before this change, setting it to datetime.datetime could silently reverse the behavior of isnull lookups. This commit doesn't have any consequences on the current code. It's just a safeguard for future ORM hackers.
2013-02-10Made Query.clear_ordering force_empty arg mandatoryAnssi Kääriäinen
Previously it was possible to call clear_ordering without the force_empty argument. The result was that the query was still ordered by model's meta ordering if that was defined. By making the arg mandatory it will be easier to spot possible errors caused by assuming clear_ordering will remove all ordering. Thanks to Dylan Klomparens for the suggestion. Refs #19720.
2013-02-10Fixed #19720 -- Oracle ordering related delete regressionAnssi Kääriäinen
When a query had a complex where condition (a condition targeting more than the base table) a subquery was used for deletion. However, the query had default ordering from the model's meta and Oracle doesn't work with ordered subqueries. The regression was caused by fast-path deletion code introduced in 1cd6e04cd4f768bcd4385b75de433d497d938f82 for fixing #18676. Thanks to Dylan Klomparens for the report.
2013-02-08Removed unneeded imports in db.models initClaude Paroz
2013-02-05Fixed #19689 -- Renamed `Model._meta.module_name` to `model_name`.Simon Charette
2013-02-04Fixed #19653 -- Removed `Manager.get_empty_query_set`.Simon Charette
2013-01-29Fixed typos in docs and commentsTim Graham
2013-01-23Remove dup_select_related method.Marc Tamlyn
This undocumented method was used in an old version of the admin, is totally untested and hails from 2008. Although it's listed in the "public methods" section, as it's not documented or used I don't think it needs a deprecation path. If we think it's useful I'll write some tests/docs for it instead...
2013-01-20Fixed #17813 -- Added a .earliest() method to QuerySetNick Sandford
Thanks a lot to everybody participating in developing this feature. The patch was developed by multiple people, at least Trac aliases tonnzor, jimmysong, Fandekasp and slurms. Stylistic changes added by committer.
2013-01-18Removed models/related.py BoundRelatedObjectAnssi Kääriäinen
The class wasn't used anywhere except in RelatedObject.bind(), which wasn't used anywhere. The class had one method defined as NotImplemented, yet the class wasn't subclassed anywhere. In short, the class was dead code.
2013-01-18Avoided unnecessary recreation of RelatedObjectsAnssi Kääriäinen
Refs #19399. Thanks to Track alias KJ for the patch.
2013-01-14Move logic seperation as its not longer repetitiveDavid Cramer
2013-01-14Send post_delete signals immediatelyDavid Cramer
In a normal relational construct, if you're listening for an event that signals a child was deleted, you dont expect that the parent was deleted already. This change ensures that post_delete signals are fired immediately after objects are deleted in the graph.
2013-01-11Removed some now dead code from deletion (thanks to Carl Meyer for noticing it).Alex Gaynor
2013-01-08Fixed #19576 -- Use `six.with_metaclass` uniformously accross code base.Simon Charette
2013-01-08Fixed #17541 -- Fixed non-saved/nullable fk queryingAnssi Kääriäinen
2013-01-08Fixed #16759 -- Remove use of __deepcopy__ in qs.clone()Anssi Kääriäinen
The original problem was that queryset cloning was really expensive when filtering with F() clauses. The __deepcopy__ went too deep copying _meta attributes of the models used. To fix this the use of __deepcopy__ in qs cloning was removed. This commit results in some speed improvements across the djangobench benchmark suite. Most query_* tests are 20-30% faster, save() is 50% faster and finally complex filtering situations can see 2x to order of magnitude improvments. Thanks to Suor, Alex and lrekucki for valuable feedback.
2013-01-06Fixed #19173 -- Made EmptyQuerySet a marker class onlyAnssi Kääriäinen
The guarantee that no queries will be made when accessing results is done by new EmptyWhere class which is used for query.where and having. Thanks to Simon Charette for reviewing and valuable suggestions.
2013-01-03Added documentation for the 'db' argument of the post-syncdb signal.mpaolini
2013-01-02Fixed PR 478 -- Removed superfluous try/except block.Aymeric Augustin
2013-01-02Fixed #19547 -- Caching of related instances.Aymeric Augustin
When &'ing or |'ing querysets, wrong values could be cached, and crashes could happen. Thanks Marc Tamlyn for figuring out the problem and writing the patch.
2012-12-30Minor improvement to proxy model handlingAnssi Kääriäinen
Refs #19385
2012-12-30Made use of PathInfo.direct flag in trim_joinsAnssi Kääriäinen
Refs #19385
2012-12-30Added Query.join_parent_model()Anssi Kääriäinen
This simplifies especially compiler.py a lot, where almost the same code was repeated multiple times. Refs #19385
2012-12-30Moved join path generation to FieldAnssi Kääriäinen
Refs #19385
2012-12-30Made sure join_field is always available in .join()Anssi Kääriäinen
Refs #19385
2012-12-29Advanced pending deprecation warnings.Aymeric Augustin
Also added stacklevel argument, fixed #18127.