Commit Graph

4972 Commits

Author SHA1 Message Date
Mariusz Felisiak b5f60ef5a7 [4.0.x] Refs #32355 -- Bumped required psycopg2 version to 2.8.4.
psycopg2 2.8.4 is the first release to support Python 3.8.
Backport of ca04659b4b from main
2021-12-22 20:33:49 +01:00
Hannes Ljungberg fed7f992ac [4.0.x] Fixed #33335 -- Made model validation ignore functional unique constraints.
Regression in 3aa545281e.

Thanks Hervé Le Roy for the report.

Backport of 1eaf38fa87 from main
2021-12-06 13:28:54 +01:00
Mariusz Felisiak 2c20883cb0 [4.0.x] 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.

Backport of 2c7846d992 from main.
2021-12-03 11:58:55 +01:00
Can Sarigol d54aa49a7d [4.0.x] Fixed #33279 -- Fixed handling time zones with "-" sign in names.
Thanks yakimka for the report.

Regression in fde9b7d35e.

Backport of 661316b066 from main.
2021-11-12 11:14:08 +01:00
Mariusz Felisiak e2fe0429ab [4.0.x] Fixed #33234 -- Fixed autodetector crash for proxy models inheriting from non-model class.
Regression in aa4acc164d.

Thanks Kevin Marsh for the report.
Backport of dab48b7482 from main
2021-11-02 15:35:52 +01:00
David Wobrock ea00a0843e [4.0.x] Fixed #31503 -- Made autodetector remove unique/index_together before altering fields.
Backport of 0314593fe8 from main
2021-10-25 10:45:35 +02:00
Hannes Ljungberg 00aa3e0b9b [4.0.x] Fixed #33194 -- Fixed migrations when altering a field with functional indexes/unique constraints on SQLite.
This adjusts Expressions.rename_table_references() to only update alias
when needed.

Regression in 83fcfc9ec8.

Co-authored-by: Simon Charette <charettes@users.noreply.github.com>

Backport of 86971c4090 from main
2021-10-18 09:36:21 +02:00
Seonghyeon Cho 1aada25eeb [4.0.x] Refs #32900 -- Restored '[y/N]' in questioner prompt when merging migrations.
Regression in 02bc7161ec.

Backport of aa0d796e37 from main
2021-10-11 09:40:06 +02:00
Daniel Hahler 81bb0ae221 [4.0.x] Fixed #33160 -- Avoided suppressing query errors in _nodb_cursor() on PostgreSQL.
Backport of 98c8bf1cee from main
2021-10-01 07:24:45 +02:00
Mariusz Felisiak 93a42d43a6 [4.0.x] 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.
Backport of 903aaa35e5 from main
2021-09-30 11:26:53 +02:00
David Wobrock b2a0978610 [4.0.x] Fixed #33018 -- Fixed annotations with empty queryset.
Thanks Simon Charette for the review and implementation idea.

Backport of dd1fa3a31b from main
2021-09-29 20:53:16 +02:00
David Wobrock aab76433ed [4.0.x] Fixed #33141 -- Renamed Expression.empty_aggregate_value to empty_result_set_value.
Backport of ad36a198a1 from main
2021-09-29 20:52:59 +02:00
Chinmoy Chakraborty 6f31041794 [4.0.x] Fixed #33033 -- Prevented models.DecimalField from accepting NaN values.
Backport of b7fd668b37 from main
2021-09-28 13:57:45 +02:00
Mariusz Felisiak 715aa2db67 [4.0.x] Fixed #33133 -- Fixed handling NullBooleanField in historical migrations.
Regression in d992f4e3c2.
Backport of 3b9fe906bf from main
2021-09-23 10:37:14 +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
Mariusz Felisiak 338fc0e7f1 Fixed #33080 -- Preserved nullability of textual fields on Oracle.
Thanks Matt Hoskins for the report.
2021-09-01 20:54:12 +02:00
Mariusz Felisiak 1eb3f500a4
Fixed #33057 -- Fixed recreation of foreign key constraints in m2m tables when altering type of referenced primary key on Oracle. 2021-08-31 13:43:10 +02:00
Jacob Walls 3219dd3388 Fixed #24900 -- Allowed migrating backward to squashed migrations. 2021-08-30 12:08:04 +02:00
Mateo Radman 02bc7161ec Fixed #32900 -- Improved migrations questioner prompts. 2021-08-27 13:27:41 +02:00
Mariusz Felisiak fa1d7ba5b9
Refs #29898 -- Changed fields in ProjectState's relation registry to dict. 2021-08-26 07:49:37 +02:00
Manav Agarwal 196a99da5d Refs #29898 -- Made ProjectState encapsulate alterations in relations registry.
Thanks Simon Charette and Chris Jerdonek for reviews.

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-08-25 09:12:01 +02:00
Tim Graham 022d29c934
Refs #10929 -- Allowed NowUTC SQL customization for third-party backends. 2021-08-24 08:28:03 +02:00
Manav Agarwal 3e6a3e8853 Refs #29898 -- Refactored out ProjectState.resolve_model_relations()/resolve_model_field_relations() hooks. 2021-08-20 13:45:21 +02:00
Matjaz Gregoric 518ce7a51f Fixed #33017 -- Fixed storage engine introspection on MySQL.
This also improves performance on MySQL instances with a large number
of databases, since querying the information_schema table can be very
slow
2021-08-20 11:05:21 +02:00
Matjaz Gregoric e9aa20e4e1 Optimized DatabaseSchemaEditor._field_should_be_indexed() on MySQL. 2021-08-20 10:30:02 +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
Chris Jerdonek 7800596924 Fixed #33014 -- Made ProjectState raise exception when real_apps argument is not a set. 2021-08-19 10:18:51 +02:00
Mariusz Felisiak 54a30a7a00 Refs #29898 -- Changed ProjectState.real_apps to set. 2021-08-11 09:01:14 +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
Jacob Walls 202d3e193a Fixed typos in migrations tests, comments, and error message. 2021-08-04 09:28:23 +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
Chris Jerdonek 5fee36973c
Optimized BaseDatabaseSchemaEditor._effective_default() a bit,
This eliminates an unneeded call to datetime.now() when
field.get_internal_type() equals "DateTimeField".
2021-07-28 08:12:01 +02:00
Chris Jerdonek fe074c96a3 Refs #32962 -- Simplified NULL logic in BaseDatabaseSchemaEditor._iter_column_sql(). 2021-07-27 20:10:25 +02:00
Chris Jerdonek 809c45ea3c Fixed #32962 -- Consolidated string concatenations in BaseDatabaseSchemaEditor.column_sql(). 2021-07-27 20:10:20 +02:00
David Smith 1cba320786
Refs #32956 -- Changed "afterwards" to "afterward" in docs and comments.
This also removes unnecessary comments with the previous spelling.

AP Stylebook has a short entry to advise the preferred spelling for
"en-us". "Afterwards" is preferred in British English.
2021-07-27 10:41:51 +02:00
Jordan Bae 3d9040a50b Refs #32743 -- Fixed recreation of foreign key constraints when altering type of referenced primary key with MTI.
Follow up to 325d7710ce.
2021-07-27 07:30:33 +02:00
David Wobrock 325d7710ce Fixed #32743 -- Added foreign key altering when altering type of referenced primary key with MTI. 2021-07-26 08:51:56 +02:00