summaryrefslogtreecommitdiff
path: root/django/db/models
AgeCommit message (Collapse)Author
2022-01-13Improved Model.__init__() properties loop.Adam Johnson
This improves readability, accumulates unrecognized arguments raise an exception with all of them, and avoids refetching the values.
2022-01-11Fixed #13251 -- Made pre/post_delete signals dispatch the origin.mgaligniana
2022-01-07Fixed #33216 -- Simpilified deconstructed paths for some expressions.Allen Jonathan David
2022-01-05Fixed #32511 -- Corrected handling prefetched nested reverse relationships.Jamie Matthews
When prefetching a set of child objects related to a set of parent objects, we usually want to populate the relationship back from the child to the parent to avoid a query when accessing that relationship attribute. However, there's an edge case where the child queryset itself specifies a prefetch back to the parent. In that case, we want to use the prefetched relationship rather than populating the reverse relationship from the parent.
2022-01-04Fixed #33406 -- Avoided creation of MaxLengthValidator(None) when resolving ↵Keryn Knight
Value.output_field for strings. This brings the behaviour in line with Field subclasses which append to the validators within __init__(), like BinaryField, and prevents the creation of a validator which incorrectly throws a TypeError, if it were used.
2021-12-21Fixed #33374 -- Fixed ExpressionWrapper annotations with full queryset.David Wobrock
2021-12-10Corrected return value of ForeignKey.db_check().Adam Johnson
Field.db_check() should return None or a SQL string. Returning [] happened to work because it’s falsey.
2021-12-08Fixed #33319 -- Fixed crash when combining with the | operator querysets ↵Ömer Faruk Abacı
with aliases that conflict.
2021-12-08Refs #33319 -- Added comment about keys/values assertion in ↵Ömer Faruk Abacı
Query.change_aliases().
2021-12-07Refs #25265 -- Allowed customizing Query's datastructure classes.Erik Cederstrand
2021-12-06Fixed #33335 -- Made model validation ignore functional unique constraints.Hannes Ljungberg
Regression in 3aa545281e0c0f9fac93753e3769df9e0334dbaa. Thanks Hervé Le Roy for the report.
2021-12-03Fixed #33333 -- Fixed setUpTestData() crash with models.BinaryField on ↵Mariusz Felisiak
PostgreSQL. This makes models.BinaryField pickleable on PostgreSQL. Regression in 3cf80d3fcf7446afdde16a2be515c423f720e54d. Thanks Adam Zimmerman for the report.
2021-12-02Fixed #33282 -- Fixed a crash when OR'ing subquery and aggregation lookups.Simon Charette
As a QuerySet resolves to Query the outer column references grouping logic should be defined on the latter and proxied from Subquery for the cases where get_group_by_cols is called on unresolved expressions. Thanks Antonio Terceiro for the report and initial patch.
2021-12-02Refs #32690 -- Altered lookups Query rhs alterations during initialization.Simon Charette
Having it happen at the lookup creation time ensures entry points called before the compilation phase (e.g. get_group_by_cols) don't have to duplicate the logic in charge of altering Query instances used as rhs. It also has the nice effect of reducing the amount of time the alteration logic to once as opposed to multiple times if the queryset is compiled more than once.
2021-11-29Fixed #33322 -- Fixed loss of assigned related object when saving relation ↵Hannes Ljungberg
with bulk_update().
2021-11-23Fixed #33309 -- Fixed QuerySet.distinct() crash on mixed case annotation.arsalan.ghassemi
2021-11-23Fixed #33304 -- Allowed passing string expressions to Window(order_by).Simon Charette
2021-11-23Refs #33304 -- Enclosed aggregate ordering logic in an expression.Simon Charette
This greatly simplifies the implementation of contrib.postgres' OrderableAggMixin and allows for reuse in Window expressions.
2021-11-19Refs #24121 -- Added __repr__() to BaseDatabaseWrapper, JoinPromoter, and ↵Jonny Park
SQLCompiler.
2021-11-08Fixed #33257 -- Fixed Case() and ExpressionWrapper() with decimal values on ↵Matthijs Kooijman
SQLite.
2021-11-08Fixed #32980 -- Made models cache related managers.Keryn Knight
2021-11-04Fixed #33262 -- Fixed crash of conditional aggregation on Exists().Hannes Ljungberg
2021-11-03Fixed #33260 -- Fixed crash when chaining QuerySet.exists() after ↵Hannes Ljungberg
select_for_update(of=()).
2021-11-03Fixed #32996 -- Cached PathInfos on relations.Keryn Knight
PathInfo values are ostensibly static over the lifetime of the object for which they're requested, so the data can be memoized, quickly amortising the cost over the process' duration.
2021-10-28Removed unused model's Options.installed.Mariusz Felisiak
Unused since f9698c43918c118a29516cbef4e23c197eb2dc25.
2021-10-21Made F deconstruction omit 'expressions' in the path.Adam Johnson
2021-10-13Refs #25265 -- Allowed Query subclasses to build filters.Erik Cederstrand
2021-10-06Fixed #33131 -- Improved error messages for clashing reverse accessor names.Bernd Wechner
2021-10-06Refs #26430 -- Removed unused branch in sql.Query.get_count().Simon Charette
Now that sql.Query.get_aggregation() properly deals with empty result sets summary Count() annotations cannot result in None. Unused since 9f3cce172f6913c5ac74272fa5fc07f847b4e112.
2021-09-30Fixed #33159 -- Reverted "Fixed #32970 -- Changed WhereNode.clone() to ↵Mariusz Felisiak
create a shallow copy of children." This reverts commit e441847ecae99dd1ccd0d9ce76dbcff51afa863c. A shallow copy is not enough because querysets can be reused and evaluated in nested nodes, which shouldn't mutate JOIN aliases. Thanks Michal Čihař for the report.
2021-09-29Fixed #33018 -- Fixed annotations with empty queryset.David Wobrock
Thanks Simon Charette for the review and implementation idea.
2021-09-29Fixed #33141 -- Renamed Expression.empty_aggregate_value to ↵David Wobrock
empty_result_set_value.
2021-09-28Fixed #33033 -- Prevented models.DecimalField from accepting NaN values.Chinmoy Chakraborty
2021-09-27Refs #32355 -- Used @functools.lru_cache as a straight decorator.Mariusz Felisiak
2021-09-24Fixed #33124 -- Avoided accessing the database connections when not necessary.Keryn Knight
Follow up to bf5abf1bdcedb15e949db419c61eeec7c88414ea. This also caches the __getitem__ access.
2021-09-24Fixed #33127 -- Added error messages on | and & operators with combined ↵Hasan Ramezani
querysets.
2021-09-23Fixed #33133 -- Fixed handling NullBooleanField in historical migrations.Mariusz Felisiak
Regression in d992f4e3c29a81c956d3d616f0bc19701431b26e.
2021-09-20Refs #27624 -- Optimized Query.clone() for non-combined queries.Keryn Knight
This avoids constructing a generator expression and a new tuple if the Query has no combined queries.
2021-09-20Fixed #32970 -- Changed WhereNode.clone() to create a shallow copy of children.Keryn Knight
2021-09-17Refs #27624 -- Changed Query.explain_info to namedtuple.Adam Johnson
2021-09-17Optimized Query.clone() a bit.Adam Johnson
This removes unnecessary "if ... is None" branches, which are already shallow-copied in the __dict__.copy() call.
2021-09-16Fixed #32365 -- Made zoneinfo the default timezone implementation.Carlton Gibson
Thanks to Adam Johnson, Aymeric Augustin, David Smith, Mariusz Felisiak, Nick Pope, and Paul Ganssle for reviews.
2021-09-09Fixed #33084 -- Removed incorrect system check for ManyToManyField with ↵Hasan Ramezani
limit_choices_to.
2021-09-01Fixed #33073 -- Fixed queryset crash with aggregation and empty/extra ↵David Wobrock
queryset annotation.
2021-08-19Fixed #33025 -- Avoided accessing the database connections in ↵Keryn Knight
Query.build_lookup() when not necessary. Of the built-in backends, only Oracle treats empty strings and nulls as equal, so avoid testing the default connection backend for interprets_empty_strings_as_nulls if it can be established from the lookup that it wouldn't affect the lookup instance returned. This improves performance a small amount for most lookups being built, because accessing the connections requires touching the thread critical `Local` which is an expensive operation.
2021-08-09Removed unnecessary WhereNode.is_summary.Mariusz Felisiak
Unnecessary since its introduction in 1df89a60c5b7a28d7fda4c9ba7c07f02fd7de0fa.
2021-08-09Fixed #33003 -- Removed **kwargs from QuerySet._chain().Keryn Knight
The functionality of updating the __dict__ was only present to allow for pickling a Prefetch object, which is a comparably rare operation. Forcing the __getstate__() implementation to handle it allows the chaining operation to be slightly faster, which is much more common.
2021-08-06Fixed #32983 -- Added system check for redundant related_name on symmetrical ↵Nick Touran
M2M fields. Since ManyToManyFields defined with `symmetrical=True` do not add a related field to the target model, including a `related_name` argument will never do what the coder likely expects. This makes including a related_name with a symmetrical model raise a system check warning. ticket-32983
2021-07-30Refs #32966 -- Refactored out DateTimeCheckMixin._check_if_value_fixed().Chris Jerdonek
2021-07-30Refs #32966 -- Simplified the _check_fix_default_value() implementations.Chris Jerdonek