David Wobrock
72b23c04d8
Fixed #33374 -- Fixed ExpressionWrapper annotations with full queryset.
2021-12-21 06:17:04 +01:00
Adam Johnson
1be99e4e0a
Corrected return value of ForeignKey.db_check().
...
Field.db_check() should return None or a SQL string.
Returning [] happened to work because it’s falsey.
2021-12-10 09:22:09 +01:00
Ömer Faruk Abacı
81739a45b5
Fixed #33319 -- Fixed crash when combining with the | operator querysets with aliases that conflict.
2021-12-08 21:16:24 +01:00
Ömer Faruk Abacı
f1bfdff690
Refs #33319 -- Added comment about keys/values assertion in Query.change_aliases().
2021-12-08 21:16:24 +01:00
Erik Cederstrand
547656c850
Refs #25265 -- Allowed customizing Query's datastructure classes.
2021-12-07 13:36:50 +01:00
Hannes Ljungberg
1eaf38fa87
Fixed #33335 -- Made model validation ignore functional unique constraints.
...
Regression in 3aa545281e
.
Thanks Hervé Le Roy for the report.
2021-12-06 07:59:11 +01:00
Mariusz Felisiak
2c7846d992
Fixed #33333 -- Fixed setUpTestData() crash with models.BinaryField on PostgreSQL.
...
This makes models.BinaryField pickleable on PostgreSQL.
Regression in 3cf80d3fcf
.
Thanks Adam Zimmerman for the report.
2021-12-03 11:56:22 +01:00
Simon Charette
e5a92d400a
Fixed #33282 -- Fixed a crash when OR'ing subquery and aggregation lookups.
...
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-02 07:23:33 +01:00
Simon Charette
e3bde71676
Refs #32690 -- Altered lookups Query rhs alterations during initialization.
...
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-12-02 07:00:52 +01:00
Hannes Ljungberg
ed2018037d
Fixed #33322 -- Fixed loss of assigned related object when saving relation with bulk_update().
2021-11-29 06:27:22 +01:00
arsalan.ghassemi
bdcda1ca9b
Fixed #33309 -- Fixed QuerySet.distinct() crash on mixed case annotation.
2021-11-23 20:43:20 +01:00
Simon Charette
aec71aaa5b
Fixed #33304 -- Allowed passing string expressions to Window(order_by).
2021-11-23 07:58:44 +01:00
Simon Charette
e06dc4571e
Refs #33304 -- Enclosed aggregate ordering logic in an expression.
...
This greatly simplifies the implementation of contrib.postgres'
OrderableAggMixin and allows for reuse in Window expressions.
2021-11-23 07:28:27 +01:00
Jonny Park
6fa2930573
Refs #24121 -- Added __repr__() to BaseDatabaseWrapper, JoinPromoter, and SQLCompiler.
2021-11-19 07:57:02 +01:00
Matthijs Kooijman
1a5023883b
Fixed #33257 -- Fixed Case() and ExpressionWrapper() with decimal values on SQLite.
2021-11-08 18:02:56 +01:00
Keryn Knight
4f8c7fd9d9
Fixed #32980 -- Made models cache related managers.
2021-11-08 08:44:12 +01:00
Hannes Ljungberg
a934d377af
Fixed #33262 -- Fixed crash of conditional aggregation on Exists().
2021-11-04 06:31:32 +01:00
Hannes Ljungberg
25157033e9
Fixed #33260 -- Fixed crash when chaining QuerySet.exists() after select_for_update(of=()).
2021-11-03 20:08:14 +01:00
Keryn Knight
a697424969
Fixed #32996 -- Cached PathInfos on relations.
...
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-11-03 11:27:04 +01:00
Mariusz Felisiak
8e3b1cf098
Removed unused model's Options.installed.
...
Unused since f9698c4391
.
2021-10-28 16:08:59 +02:00
Adam Johnson
45f48ed4f7
Made F deconstruction omit 'expressions' in the path.
2021-10-21 09:40:52 +02:00
Erik Cederstrand
14c8504a37
Refs #25265 -- Allowed Query subclasses to build filters.
2021-10-13 07:31:25 +02:00
Bernd Wechner
2116238d5f
Fixed #33131 -- Improved error messages for clashing reverse accessor names.
2021-10-06 12:33:15 +02:00
Simon Charette
0f3e1a54bf
Refs #26430 -- Removed unused branch in sql.Query.get_count().
...
Now that sql.Query.get_aggregation() properly deals with empty result
sets summary Count() annotations cannot result in None.
Unused since 9f3cce172f
.
2021-10-06 07:25:17 +02:00
Mariusz Felisiak
903aaa35e5
Fixed #33159 -- Reverted "Fixed #32970 -- Changed WhereNode.clone() to create a shallow copy of children."
...
This reverts commit e441847eca
.
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-30 11:26:17 +02:00
David Wobrock
dd1fa3a31b
Fixed #33018 -- Fixed annotations with empty queryset.
...
Thanks Simon Charette for the review and implementation idea.
2021-09-29 20:23:29 +02:00
David Wobrock
ad36a198a1
Fixed #33141 -- Renamed Expression.empty_aggregate_value to empty_result_set_value.
2021-09-29 12:58:01 +02:00
Chinmoy Chakraborty
b7fd668b37
Fixed #33033 -- Prevented models.DecimalField from accepting NaN values.
2021-09-28 13:20:14 +02:00
Mariusz Felisiak
5bac1719a2
Refs #32355 -- Used @functools.lru_cache as a straight decorator.
2021-09-27 09:10:58 +02:00
Keryn Knight
06c50cee0f
Fixed #33124 -- Avoided accessing the database connections when not necessary.
...
Follow up to bf5abf1bdc
.
This also caches the __getitem__ access.
2021-09-24 12:19:39 +02:00
Hasan Ramezani
f997c81472
Fixed #33127 -- Added error messages on | and & operators with combined querysets.
2021-09-24 06:59:22 +02:00
Mariusz Felisiak
3b9fe906bf
Fixed #33133 -- Fixed handling NullBooleanField in historical migrations.
...
Regression in d992f4e3c2
.
2021-09-23 10:36:30 +02:00
Keryn Knight
5353e7c250
Refs #27624 -- Optimized Query.clone() for non-combined queries.
...
This avoids constructing a generator expression and a new tuple if the
Query has no combined queries.
2021-09-20 12:34:18 +02:00
Keryn Knight
e441847eca
Fixed #32970 -- Changed WhereNode.clone() to create a shallow copy of children.
2021-09-20 07:03:10 +02:00
Adam Johnson
fc91ea1e50
Refs #27624 -- Changed Query.explain_info to namedtuple.
2021-09-17 07:15:12 +02:00
Adam Johnson
2931d847c2
Optimized Query.clone() a bit.
...
This removes unnecessary "if ... is None" branches, which are already
shallow-copied in the __dict__.copy() call.
2021-09-17 07:12:56 +02:00
Carlton Gibson
306607d5b9
Fixed #32365 -- Made zoneinfo the default timezone implementation.
...
Thanks to Adam Johnson, Aymeric Augustin, David Smith, Mariusz Felisiak, Nick
Pope, and Paul Ganssle for reviews.
2021-09-16 12:11:05 +02:00
Hasan Ramezani
0a28b42b15
Fixed #33084 -- Removed incorrect system check for ManyToManyField with limit_choices_to.
2021-09-09 12:07:59 +02:00
David Wobrock
691486a5cf
Fixed #33073 -- Fixed queryset crash with aggregation and empty/extra queryset annotation.
2021-09-01 20:59:16 +02:00
Keryn Knight
bf5abf1bdc
Fixed #33025 -- Avoided accessing the database connections in 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-19 13:28:59 +02:00
Mariusz Felisiak
b64db05b9c
Removed unnecessary WhereNode.is_summary.
...
Unnecessary since its introduction in 1df89a60c5
.
2021-08-09 19:23:29 +02:00
Keryn Knight
921e4ccb77
Fixed #33003 -- Removed **kwargs from QuerySet._chain().
...
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-09 13:28:40 +02:00
Nick Touran
5d4f21b16f
Fixed #32983 -- Added system check for redundant related_name on symmetrical 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-08-06 11:57:02 +02:00
Chris Jerdonek
6f5e07a84d
Refs #32966 -- Refactored out DateTimeCheckMixin._check_if_value_fixed().
2021-07-30 10:15:43 +02:00
Chris Jerdonek
6fa5d05dba
Refs #32966 -- Simplified the _check_fix_default_value() implementations.
2021-07-30 09:31:29 +02:00
Chris Jerdonek
eebebfe0a9
Refs #32966 -- Added _to_naive() and _get_naive_now() for use in DateTimeCheckMixin classes.
2021-07-30 09:31:24 +02:00
Chris Jerdonek
542e749475
Fixed #32966 -- Fixed TimeField.check() crash for timezone-aware times in default when USE_TZ = True.
2021-07-30 09:15:39 +02:00
Keryn Knight
9662193aea
Refs #32946 -- Changed internal usage of dynamic Q() objects construction to use non-kwargs initialization.
...
This prefers non-kwargs construction of dynamically generated Q()
objects to create a single Q() object instead of many and then
combining them, where possible.
2021-07-28 09:38:46 +02:00
Keryn Knight
5b8ef8aa5b
Refs #32946 -- Changed Query.add_filter() to take two arguments.
2021-07-28 09:38:42 +02:00
Tom Wojcik
20226fcd46
Fixed #32947 -- Fixed hash() crash on reverse M2M relation when through_fields is a list.
...
Regression in c32d8f33d8
.
2021-07-26 06:09:29 +02:00