summaryrefslogtreecommitdiff
path: root/django/db/models
AgeCommit message (Collapse)Author
2020-01-15Fixed #31124 -- Fixed setting of get_FOO_display() when overriding inherited ↵Carlton Gibson
choices. Regression in 2d38eb0ab9f78d68c083a5b78b1eca39027b279a
2020-01-15Refs #31136 -- Made QuerySet.values()/values_list() group only by selected ↵Mariusz Felisiak
annotation. Regression in 0f843fdd5b9b2f2307148465cd60f4e1b2befbb4.
2020-01-15Fixed #29871 -- Allowed setting pk=None on a child model to create a copy.chetan22
Thanks Simon Charette and Tim Graham for the initial patch.
2020-01-11Fixed #31155 -- Fixed a system check for the longest choice when a named ↵Mariusz Felisiak
group contains only non-string values. Regression in b6251956b69512bf230322bd7a49b629ca8455c6. Thanks Murat Guchetl for the report.
2020-01-10Fixed #31154 -- Added support for using enumeration types in templates.Adam Johnson
Enumeration helpers are callables, so the template system tried to call them with no arguments. Thanks Rupert Baker for helping discover this.
2020-01-09Fixed #31148 -- Added error messages on update()/delete() operations ↵Hasan Ramezani
following union(), intersection(), and difference().
2020-01-09Fixed #21238 -- Fixed restoring attributes when pickling FileField and ↵Hasan Ramezani
ImageField.
2020-01-07Simplified model's Options.add_field() a bit.Taoup
2020-01-04Fixed #31136 -- Disabled grouping by aliases on QuerySet.values()/values_list().Mariusz Felisiak
Regression in fb3f034f1c63160c0ff13c609acd01c18be12f80. Thanks Sigurd Ljødal for the report.
2019-12-30Fixed #31071 -- Disabled insert optimization for primary keys with defaults ↵Simon Charette
when loading fixtures. Model.save_base() is called directly when loading fixtures and assumes existing rows will be updated. Branching of "raw" allows to maintain the optimization introduced in #29260 while supporting this edge case. Regression in 85458e94e38c20e57939947ee515a1a53689659f. Thanks Reupen Shah for the report.
2019-12-23Fixed #31109 -- Disabled grouping by aliases on QuerySet.exists().Simon Charette
Clearing the SELECT clause in Query.has_results was orphaning GROUP BY references to it. Thanks Thierry Bastian for the report and Baptiste Mispelon for the bisect. Regression in fb3f034f1c63160c0ff13c609acd01c18be12f80.
2019-12-19Fixed #31095 -- Made RelatedManager.set() preserve existing m2m relations ↵Hasan Ramezani
with an invalid type.
2019-12-19Fixed #31094 -- Included columns referenced by subqueries in GROUP BY on ↵Simon Charette
aggregations. Thanks Johannes Hoppe for the report. Regression in fb3f034f1c63160c0ff13c609acd01c18be12f80. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2019-12-16Optimized containment check in ChoicesMeta.Ram Rachum
2019-12-10Used Signature API instead of deprecated inspect.getcallargs().Baptiste Mispelon
inspect.getcallargs() was deprecated in Python 3.5 and the Signature API (PEP 362) has better support for decorated functions (by default, it follows the __wrapped__ attribute set by functools.wraps for example).
2019-12-09Refs #31044 -- Fixed error message when using Prefetch with a values_list() ↵Mariusz Felisiak
queryset.
2019-12-09Fixed #31044 -- Errored nicely when using Prefetch with a raw() queryset.Hasan Ramezani
2019-12-06Made Query.check_filterable() use bool by default instead of str.Alex Aktsipetrov
2019-12-06Fixed #31060 -- Reallowed window expressions to be used in conditions ↵Alex Aktsipetrov
outside of queryset filters. Regression in 4edad1ddf6203326e0be4bdb105beecb0fe454c4. Thanks utapyngo for the report.
2019-12-03Fixed #31046 -- Allowed RelatedManager.add()/create()/set() to accept ↵Baptiste Mispelon
callable values in through_defaults.
2019-12-03Simplified RelatedManager._add_items() a bit.Baptiste Mispelon
Added early return in RelatedManager._add_items() to decrease an indentation level.
2019-12-03Refs #31046 -- Added django.db.models.utils.resolve_callables().Baptiste Mispelon
2019-12-02Fixed #30953 -- Made select_for_update() lock queryset's model when using ↵Mariusz Felisiak
"self" with multi-table inheritance. Thanks Abhijeet Viswa for the report and initial patch.
2019-11-22Fixed #8467 -- Prevented crash when adding existent m2m relation with an ↵Simon Charette
invalid type. This was an issue anymore on backends that allows conflicts to be ignored (Refs #19544) as long the provided values were coercible to the expected type. However on the remaining backends that don't support this feature, namely Oracle, this could still result in an IntegrityError. By attempting to coerce the provided values to the expected types in Python beforehand we allow the existing value set intersection in ManyRelatedManager._get_missing_target_ids to prevent the problematic insertion attempts. Thanks Baptiste Mispelon for triaging this old ticket against the current state of the master branch.
2019-11-21Refs #25367 -- Made Query.build_filter() raise TypeError on non-conditional ↵Simon Charette
expressions.
2019-11-21Fixed #30484 -- Added conditional expressions support to CheckConstraint.Simon Charette
2019-11-21Refs #25367 -- Moved conditional expression wrapping to the Exact lookup.Simon Charette
2019-11-21Refs #11964 -- Removed SimpleCol in favor of Query(alias_cols).Simon Charette
This prevent having to pass simple_col through multiple function calls by defining whether or not references should be resolved with aliases at the Query level.
2019-11-19Fixed #27272 -- Added an on_delete RESTRICT handler to allow cascading ↵Daniel Izquierdo
deletions while protecting direct ones.
2019-11-19Refs #27272 -- Added Collector.add_dependency().Daniel Izquierdo
2019-11-19Fixed #30987 -- Added models.PositiveBigIntegerField.Caio Ariede
2019-11-18Fixed #30988 -- Deprecated the InvalidQuery exception.Simon Charette
It was barely documented without pointers at its defining location and was abused to prevent misuse of the QuerySet field deferring feature.
2019-11-18Replaced QueryWrapper single usage with RawSQL.Simon Charette
2019-11-13Fixed #30971 -- Prevented Query.resolve_lookup_value() from coercing list ↵George Marshall
values to tuples. Regression in 8a281aa7fe76a9da2284f943964a9413697cff1f.
2019-11-08Fixed #24858 -- Added support for get_FOO_display() to ArrayField and ↵Hasan Ramezani
RangeFields. _get_FIELD_display() crashed when Field.choices was unhashable.
2019-11-05Refs #30095 -- Added Field._choices_is_value().Hasan Ramezani
This allows fields classes to override the validation of choices' values.
2019-11-04Refs #13312 -- Simplified handling of nulls ordering on MySQL.Nick Pope
MySQL & MariaDB support the standard IS NULL and IS NOT NULL so the same workaround used for NULLS FIRST and NULLS LAST that is used for SQLite < 3.30.0 can be used. Thanks Simon Charette for the discussion.
2019-11-04Fixed #30931 -- Restored ability to override Model.get_FIELD_display().Carlton Gibson
Thanks Sergey Fedoseev for the implementation idea. Regression in a68ea231012434b522ce45c513d84add516afa60.
2019-10-31Refs #13312 -- Removed unnecessary IF wrapping in nulls_last handling on MySQL.Simon Charette
ISNULL function already returns 0 and 1 on MySQL.
2019-10-31Refs #30095 -- Simplified Field._check_choices() a bit.Mariusz Felisiak
Using an internal is_value() hook to check whether Field.choices is iterable is misleading.
2019-10-29Fixed #30899 -- Lazily compiled import time regular expressions.Hasan Ramezani
2019-10-25Fixed #30902 -- Added __str__() for model choice enums.Carlton Gibson
Allows expected behavior when cast to str, also matching behaviour of created instances with those fetched from the DB. Thanks to Simon Charette, Nick Pope, and Shai Berger for reviews.
2019-10-24Fixed #23576 -- Implemented multi-alias fast-path deletion in MySQL backend.Simon Charette
This required moving the entirety of DELETE SQL generation to the compiler where it should have been in the first place and implementing a specialized compiler on MySQL/MariaDB. The MySQL compiler relies on the "DELETE table FROM table JOIN" syntax for queries spanning over multiple tables.
2019-10-23Fixed #29919 -- Fixed RelatedOnlyFieldListFilter crash with reverse ↵Dan Moore
relationships.
2019-10-21Fixed #20577 -- Deferred filtering of prefetched related querysets.Alex Aktsipetrov
Added internal interface to QuerySet that allows to defer next filter call till .query is accessed. Used it to optimize prefetch_related(). Thanks Simon Charette for the review.
2019-10-21Adjusted QuerySet._filter_or_exclude() call to use negated=False, rather ↵Alex Aktsipetrov
than None. None was a remnant from the times _filter_or_exclude accepted qtype/mapper as the first arg.
2019-10-21Fixed #30827 -- Made batch_size arg of QuerySet.bulk_create() respect ↵Ahmet Kucuk
DatabaseOperations.bulk_batch_size(). Thanks Chetan Khanna for tests.
2019-10-21Fixed #30841 -- Deprecated using non-boolean values for isnull lookup.André Ericson
2019-10-17Refs #12990 -- Moved CheckFieldDefaultMixin to the ↵sage
django.db.models.fields.mixins.
2019-10-11Fixed #30854 -- Fixed QuerySet.select_related() with multiple FilteredRelations.Hasan Ramezani