summaryrefslogtreecommitdiff
path: root/django/db/models
AgeCommit message (Collapse)Author
2012-12-28Fix #19524 -- Incorrect caching of parents of unsaved model instances.Aymeric Augustin
Thanks qcwxezdas for the report. Refs #13839.
2012-12-27Fixed #19525 -- Reverted dcd4383107 and 05d333ba3b.Aymeric Augustin
Refs #9893, #18515. Thanks Russell for the report.
2012-12-20Fixed a regression in distinct_onAnssi Kääriäinen
Caused by regression fix for #19500.
2012-12-20Fixed #18854 -- Join promotion in disjunction casesAnssi Kääriäinen
The added promotion logic is based on promoting any joins used in only some of the childs of an OR clause unless the join existed before the OR clause addition.
2012-12-20Fixed #19500 -- Solved a regression in join reuseAnssi Kääriäinen
The ORM didn't reuse joins for direct foreign key traversals when using chained filters. For example: qs.filter(fk__somefield=1).filter(fk__somefield=2)) produced two joins. As a bonus, reverse onetoone filters can now reuse joins correctly The regression was caused by the join() method refactor in commit 68847135bc9acb2c51c2d36797d0a85395f0cd35 Thanks for Simon Charette for spotting some issues with the first draft of the patch.
2012-12-20Fixed #19401 -- Ensure that swappable model references are case insensitive.Russell Keith-Magee
This is necessary because get_model() checks are case insensitive, and if the swapable check isn't, the swappable logic gets tied up in knots with models that are partially swapped out. Thanks to chris@cogdon.org for the report and extensive analysis, and Preston for his work on the draft patch.
2012-12-18Merge remote-tracking branch 'core/master' into schema-alterationAndrew Godwin
Conflicts: django/db/models/loading.py django/db/models/options.py
2012-12-17Replaced '__' with LOOKUP_SEP in sql/query.pyAnssi Kääriäinen
Thanks to Simon Charette for report.
2012-12-16Fixed #16679 -- Use caching to speed up signal sendingAnssi Kääriäinen
2012-12-16Fixed #10790 -- Refactored sql.Query.setup_joins()Anssi Kääriäinen
This is a rather large refactoring. The "lookup traversal" code was splitted out from the setup_joins. There is now names_to_path() method which does the lookup traveling, the actual work of setup_joins() is calling names_to_path() and then adding the joins found into the query. As a side effect it was possible to remove the "process_extra" functionality used by genric relations. This never worked for left joins. Now the extra restriction is appended directly to the join condition instead of the where clause. To generate the extra condition we need to have the join field available in the compiler. This has the side-effect that we need more ugly code in Query.__getstate__ and __setstate__ as Field objects aren't pickleable. The join trimming code got a big change - now we trim all direct joins and never trim reverse joins. This also fixes the problem in #10790 which was join trimming in null filter cases.
2012-12-16Fixed #18816 -- Removed "trim" argument from add_filter()Anssi Kääriäinen
The trim argument was used by split_exclude() only to trim the last join from the given lookup. It is cleaner to just trim the last part from the lookup in split_exclude() directly so that there is no need to burden add_filter() with the logic needed for only split_exclude().
2012-12-16Fixed #19469 -- Removed opts.get_ordered_objects() and related codeAnssi Kääriäinen
The code was dead-code since 2006.
2012-12-08Fixed #19357 -- Allow non-ASCII chars in filesystem pathsClaude Paroz
Thanks kujiu for the report and Aymeric Augustin for the review.
2012-12-01Typeo in ValuesQuerySet._as_sql docstringorblivion
2012-11-28Fixed #14694 -- Made ``defer()`` work with reverse relationsTai Lee
Reverse o2o fields are now usable with defer.
2012-11-27Removed duplicate opts.pk_index() methodAnssi Kääriäinen
2012-11-27Fixed #19362 -- Detected invalid use of @python_2_unicode_compatible.Aymeric Augustin
Thanks m3wolf for the report and akaariai for reproducing the problem.
2012-11-24Updated stale docstring of setup_joinsAnssi Kääriäinen
2012-11-24Fixed #19806 -- Ensure that content types and permissions aren't created for ↵Russell Keith-Magee
swapped models. Thanks to rizumu for the report.
2012-11-23Fixed #18375 -- Removed dict-ordering dependency for F-expressionsAnssi Kääriäinen
F() expressions reuse joins like any lookup in a .filter() call - reuse multijoins generated in the same .filter() call else generate new joins. Also, lookups can now reuse joins generated by F(). This change is backwards incompatible, but it is required to prevent dict randomization from generating different queries depending on .filter() kwarg ordering. The new way is also more consistent in how joins are reused.
2012-11-15Fixed a regression in select_relatedAnssi Kääriäinen
The regression was caused by the fix for #13781 (commit f51e409a5fb34020e170494320a421503689aea0). Reason was leaving off some crucial lines when resolving a merge conflict.
2012-11-15Fixed #13781 -- Improved select_related in inheritance situationsAnssi Kääriäinen
The select_related code got confused when it needed to travel a reverse relation to a model which had different parent than the originally travelled relation. Thanks to Trac aliases shauncutts for report and ungenio for original patch (committed patch is somewhat modified version of that).
2012-11-15Fixed #19058 -- Fixed Oracle GIS crashAnssi Kääriäinen
The problem is the same as in #10888 which was reintroduced when bulk_insert was added. Thanks to Jani Tiainen for report, patch and also testing the final patch on Oracle GIS.
2012-11-13Fixed select_related performance regressionsAnssi Kääriäinen
The regression was caused by select_related fix for Oracle, commit c159d9cec0baab7bbd04d5d51a92a51e354a722a.
2012-11-13Removed use of SortedDict for query.alias_refcountAnssi Kääriäinen
This will have a smallish impact on performance. Refs #19276.
2012-11-08Fixed #17144 -- MySQL again groups by PK onlyAnssi Kääriäinen
Thanks to Christian Oudard for the report and tests.
2012-11-04use six.string_types for python3Mike Johnson
2012-11-04model_split: Fixed #19236 - fixed error for abstract models with a split methodMike Johnson
2012-11-04Fixed #5805 -- it is now possible to specify multi-column indexes. Thanks to ↵Alex Gaynor
jgelens for the original patch.
2012-11-03Fixed #18963 -- Used a subclass-friendly patternAymeric Augustin
for Python 2 object model compatibility methods.
2012-11-02Deprecated depth kwarg on select_related.Preston Holmes
This is the start of a deprecation path for the depth kwarg on select_related. Removing this will allow us to update select_related so it chains properly and have an API similar to prefetch_related. Thanks to Marc Tamlyn for spearheading and initial patch. refs #16855
2012-10-31Removed dupe_avoidance from sql/query and sql/compiler.pyAnssi Kääriäinen
The dupe avoidance logic was removed as it doesn't seem to do anything, it is complicated, and it has nearly zero documentation. The removal of dupe_avoidance allowed for refactoring of both the implementation and signature of Query.join(). This refactoring cascades again to some other parts. The most significant of them is the changes in qs.combine(), and compiler.select_related_descent().
2012-10-28Fixed #18823 -- Ensured m2m.clear() works when using through+to_fieldAnssi Kääriäinen
There was a potential data-loss issue involved -- when clearing instance's m2m assignments it was possible some other instance's m2m data was deleted instead. This commit also improved None handling for to_field cases.
2012-10-27Fixed Oracle failure caused by None converted to '' in select_related caseAnssi Kääriäinen
2012-10-27Fixed #19190 -- Refactored Query select clause attributesAnssi Kääriäinen
The Query.select and Query.select_fields were collapsed into one list because the attributes had to be always in sync. Now that they are in one attribute it is impossible to edit them out of sync. Similar collapse was done for Query.related_select_cols and Query.related_select_fields.
2012-10-26Merge branch 'master' into schema-alterationAndrew Godwin
Conflicts: django/db/backends/__init__.py django/db/models/fields/related.py django/db/models/options.py
2012-10-26Fixed #15040 - Boolean fields return 0 and 1 when loaded through select_relatedLuke Plant
Thanks to homm for the report and ramiro for the patch.
2012-10-25Fixed regression caused by #19102Anssi Kääriäinen
2012-10-25Fixed #19187 -- Raise consistent error from qs.values().delete()Anssi Kääriäinen
2012-10-25Added docstring to DeleteQuery.delete_qs()Anssi Kääriäinen
2012-10-25Fixed #19102 -- Fixed fast-path delete for modified SELECT clause casesAnssi Kääriäinen
There was a bug introduced in #18676 which caused fast-path deletes implemented as "DELETE WHERE pk IN <subquery>" to fail if the SELECT clause contained additional stuff (for example extra() and annotate()). Thanks to Trac alias pressureman for spotting this regression.
2012-10-21Fixed #19151 -- Added missing methods to EmptyQuerySet.Jan Bednařík
Added values() and values_list() methods to EmptyQuerySet.
2012-10-10Moved F() '&' and '|' to .bitand() and .bitor()Anssi Kääriäinen
Done for consistency with Q() expressions and QuerySet combining. This will allow usage of '&' and '|' as boolean logical operators in the future. Refs #16211.
2012-10-10Revert "Fixed #16211 -- Added comparison and negation ops to F() expressions"Anssi Kääriäinen
This reverts commit 28abf5f0ebc9d380f25dd278d7ef4642c4504545. Conflicts: docs/releases/1.5.txt
2012-10-10Fixed #19096 -- Made can_return_id_from_insert more extendableMichael Manfre
RETURNING is an extension of the SQL standard, which is not implemented the same by all databases. Allow DatabaseOperations.return_insert_id to return a None to allow for other 3rd party backends with a different implementation.
2012-10-09Fix exception message from 3190abcd. Refs #18153.Aymeric Augustin
Thanks Preston Holmes.
2012-10-09Fixed #18153 -- Reverse OneToOne lookups on unsaved instances.Aymeric Augustin
Thanks David Hatch and Anssi Kääriäinen for their inputs.
2012-10-08Fixed #19087 -- Ensured query's base table is never LOUTER joinedAnssi Kääriäinen
This fixes a regression created by join promotion logic refactoring: 01b9c3d5193fe61b82ae8b26242a13fdec22f211 Thanks to Ivan Virabyan for the report.
2012-10-06Fixed #19069 -- Improved the error message when trying to query a swapped model.Russell Keith-Magee
Thanks to Preston Holmes for the suggestion.
2012-10-03Fixed #19049 -- Corrected dumb logic negation error from earlier patch.Russell Keith-Magee