1
0
mirror of https://github.com/django/django.git synced 2025-05-05 14:37:31 +00:00

20040 Commits

Author SHA1 Message Date
Georgi Yanchev
0ee842bb45 Fixed #36146 -- Recorded applied/unapplied migrations recursively. 2025-02-13 12:52:06 +01:00
Mariusz Felisiak
54a902c6e8 Reverted "Refs #35803 -- Added support for __coveredby GIS lookup on MariaDB 11.7+."
This partly reverts commit 0b7edb9fcdd33d47ec5701b4f9b9553e27a88e95.

MariaDB reverted GIS functions.
2025-02-13 10:38:04 +01:00
Mariusz Felisiak
eb70aafdba Reverted "Fixed #35803 -- Added support for Collect, GeoHash, and IsValid on MariaDB 11.7+."
This reverts commit c77573716a58af32ffcfc4fe87ff9e5c97909bd2.

MariaDB reverted GIS functions.
2025-02-13 10:38:04 +01:00
Simon Charette
d386405e04 Refs #36181 -- Removed the obsolete SubqueryConstraint machinery.
Adding proper support for subquery right-hand-sides to TupleIn made it
obsolete.
2025-02-13 09:29:24 +01:00
Simon Charette
8561100425 Fixed #36181 -- Allowed Subquery usage in __in lookups against composite pks.
Thanks Jacob Walls for the report.
2025-02-13 09:29:24 +01:00
Simon Charette
41239fe34d Fixed #36149 -- Allowed subquery values against tuple exact and in lookups.
Non-tuple exact and in lookups have specialized logic for subqueries that can
be adapted to properly assign select mask if unspecified and ensure the number
of involved members are matching on both side of the operator.
2025-02-11 09:08:35 +01:00
Natalia
0597e8ad1e Refs #35515 -- Fixed shell command verbose output when auto-importing 0 or 1 object.
Co-authored-by: Salvo Polizzi <salvopolizzi03@gmail.com>
2025-02-10 22:58:26 -03:00
Natalia
44ccd20375 Refs #35515 -- Refactored internal get_and_report_namespace in the shell command. 2025-02-10 22:58:26 -03:00
Simon Charette
4a3ad9eebb Fixed #36148 -- Enabled native tuple comparison lookups on SQLite 3.37+ and Oracle 23.4+.
VALUES must be explicitly specified when declaring a sequence of tuples
on SQLite < 3.37 but it's not required on >= 3.37.

See sqlite/sqlite@9289f51 which addressed the last remaining issue with
IN.
2025-02-09 17:45:16 +01:00
Simon Charette
a0a765ddeb Refs #36148 -- Relied on a feature switch to define tuple lookups support.
This should allow backends more easily opt-in or out of native support and rely
on the fallback if unavailable.
2025-02-09 15:15:15 +01:00
Simon Charette
c326cfe3b1 Refs #373 -- Delegated Tuple compilation to compiler.
This should allow third-party backends to define Tuple.as_vendor()
overrides that are taken into consideration which calling as_sql()
directly prevents.
2025-02-09 15:15:15 +01:00
Mariusz Felisiak
17160819f3
Fixed #36105 -- Dropped support for MariaDB 10.5. 2025-02-09 12:57:40 +01:00
Simon Charette
0bac41fc7e Refs #34975 -- Removed unnecessary lookups.In.get_refs().
Now that In.get_source_expression() includes its right-hand-side when it
contains expressions (refs #36025) it no longer requires a specialized
get_refs() method.
2025-02-06 16:57:44 +01:00
Simon Charette
089deb82b9 Fixed #36025 -- Fixed re-aliasing of iterable (in/range) lookups rhs.
In order for Expression.relabeled_clone to work appropriately its
get_source_expressions method must return all resolvable which wasn't the case
for Lookup when its right-hand-side is "direct" (not a compilable).

While refs #22288 added support for non-literals iterable right-hand-side
lookups it predated the subclassing of Lookup(Expression) refs #27021 which
could have been an opportunity to ensure right-hand-sides are always resolvable
(ValueList and ExpressionList).

Addressing all edge case with non-resolvable right-hand-sides would require
a significant refactor and deprecation of some parts of the Lookup interface so
this patch only focuses on FieldGetDbPrepValueIterableMixin (In and Range
lookups) by making sure that a right-hand-side containing resolvables are dealt
with appropriately during the resolving phase.

Thanks Aashay Amballi for the report.
2025-02-06 16:57:44 +01:00
brian
b13b8684a0 Fixed #36061 -- Added migration support for ManyToManyField.through_fields.
Added through_fields support to ManyToManyField.deconstruct.
Thanks to Simon Charette for pointers and the review.
2025-02-06 15:26:12 +01:00
Simon Charette
2598b371a9 Fixed #35677 -- Avoided non-sticky filtering of prefetched many-to-many.
The original queryset._next_is_sticky() call never had the intended effect as
no further filtering was applied internally after the pk__in lookup making it
a noop.

In order to be coherent with how related filters are applied when retrieving
objects from a related manager the effects of what calling _next_is_sticky()
prior to applying annotations and filters to the queryset provided for
prefetching are emulated by allowing the reuse of all pre-existing JOINs.

Thanks David Glenck and Thiago Bellini Ribeiro for the detailed reports and
tests.
2025-02-06 14:27:51 +01:00
Ben Cail
db7b1ae9f6 Refs #22997 -- Prevented requesting a default value for auto fields. 2025-02-06 13:53:43 +01:00
Natalia
1f33f21fca Fixed #36165 -- Made PostgreSQL's SchemaEditor._delete_index_sql() respect the "sql" argument.
This is a follow up of bd366ca2aeffa869b7dbc0b0aa01caea75e6dc31.

Thank you Daniel Finch for the report.
2025-02-05 20:15:39 -03:00
antoliny0919
1330cb5705 Fixed #36069 -- Fixed the delete button position in TabularInlines. 2025-02-04 07:56:23 +00:00
antoliny0919
b1324a680a Fixed #36055 -- Prevented overlap of object-tools buttons and page header in the admin. 2025-02-04 07:47:26 +00:00
Arnaldo Govenem
8ff1399f06 Fixed #36058 -- Refactored SpatialRefSysMixin.srs to use cached_property.
Replaced manual caching complexity with cached_property for efficiency.
Enhanced error handling with distinct messages for WKT and PROJ.4.

Thanks to Sarah Boyce for the suggestions.
2025-02-04 07:40:02 +00:00
Andrew Harris
5f30fd2358 Refs #36036 -- Added support for GEOSHasM. 2025-02-03 11:34:23 +00:00
Simon Charette
198b30168d Fixed #36135 -- Fixed reverse GenericRelation prefetching.
The get_(local|foreign)_related_value methods of GenericRelation must be
reversed because it defines (from|to)_fields and associated related_fields
in the reversed order as it's effectively a reverse GenericForeignKey
itself.

The related value methods must also account for the fact that referenced
primary key values might be stored as a string on the model defining the
GenericForeignKey but as integer on the model defining the GenericRelation.
This is achieved by calling the to_python method of the involved content type
in get_foreign_related_value just like GenericRelatedObjectManager does.

Lastly reverse many-to-one manager's prefetch_related_querysets should use
set_cached_value instead of direct attribute assignment as direct assignment
might are disallowed on ReverseManyToOneDescriptor descriptors. This is likely
something that was missed in f5233dc (refs #32511) when the is_cached guard
was added.

Thanks 1xinghuan for the report.
2025-02-03 09:39:14 +00:00
nessita
d15454a6e8
Fixed #36140 -- Allowed BaseUserCreationForm to define non required password fields.
Regression in e626716c28b6286f8cf0f8174077f3d2244f3eb3.

Thanks buffgecko12 for the report and Sarah Boyce for the review.
2025-02-01 22:49:07 -03:00
Simon Charette
4608d34b34 Fixed #36088 -- Avoided unnecessary DEFAULT usage on bulk_create().
When all values of a field with a db_default are DatabaseDefault, which
is the case most of the time, there is no point in specifying explicit
DEFAULT for all INSERT VALUES as that's what the database will do anyway
if not specified.

In the case of PostgreSQL doing so can even be harmful as it prevents
the usage of the UNNEST strategy and in the case of Oracle, which
doesn't support the usage of the DEFAULT keyword, it unnecessarily
requires providing literal db defaults.

Thanks Lily Foote for the review.
2025-02-01 18:43:10 +01:00
greg
89e28e13ec Fixed #36119 -- Fixed UnicodeEncodeError when attaching a file with 8bit Content-Transfer-Encoding. 2025-01-31 11:54:12 +00:00
sharonwoo
cbb0812683 Fixed #35235 -- Removed caching of BaseExpression._output_field_or_none. 2025-01-30 12:48:45 +00:00
Mohammadreza Eskandari
12b9ef38b3 Fixed #36121 -- Allowed customizing the admin site password change form. 2025-01-30 11:19:05 +00:00
Vinko Mlačić
c6ace896a2 Fixed #36155 -- Improved error handling when annotate arguments require an alias.
Regression in ed0cbc8d8b314e3b4a0305d0be3cf366d8ee4a74.
2025-01-30 11:17:17 +00:00
Sarah Boyce
5a2c1bc07d Fixed #36118 -- Accounted for multiple primary keys in bulk_update max_batch_size.
Co-authored-by: Simon Charette <charette.s@gmail.com>
2025-01-29 09:11:54 +00:00
Simon Charette
efec74b908 Fixed #36122 -- Raised FieldError when updating with composite reference value.
Thanks Jacob Walls for the report and test.
2025-01-28 12:05:53 +00:00
Jacob Walls
72ff18d41c Fixed #36120 -- Raised FieldError when targeting a composite primary key field with QuerySet.update(). 2025-01-28 10:19:43 +00:00
Mariusz Felisiak
d9af197801
Refs #36005 -- Bumped minimum supported versions of 3rd-party packages.
This bumps minimum supported versions of 3rd-party packages to the first
releases to support Python 3.12.
2025-01-28 08:02:13 +01:00
Peter DeVita
8eca4077f6 Fixed #36109 -- Fixed RecursionError when stacking FilteredRelation joins. 2025-01-27 10:32:19 +01:00
Jacob Walls
330d89d4fe
Fixed #36111 -- Fixed test --debug-sql crash on Oracle when no prior query has executed. 2025-01-25 18:06:11 +01:00
Claude Paroz
2c47207b3c Fixed #36010 -- Avoided touching mo files while checking writability. 2025-01-23 11:36:43 +01:00
Mike Edmunds
29ba75e6e5 Fixed #36013 -- Removed use of IDNA-2003 in django.utils.html.
Removed obsolete and potentially problematic IDNA 2003 ("punycode")
encoding of international domain names in smart_urlquote() and Urlizer,
which are used (only) by AdminURLFieldWidget and the urlize/urlizetrunc
template filters. Changed to use percent-encoded UTF-8, which defers
IDNA details to the browser (like other URLs rendered by Django).
2025-01-23 10:38:15 +01:00
Claude Paroz
23c960a98e
Refs #27674 -- Removed unused GIS icons.
Unused since 4982958ec0c359908566fc1f34ef71297ea4337d.
2025-01-23 09:33:13 +01:00
antoliny0919
e262d5355d Fixed #36114 -- Fixed link visibility when list_display_links field contains only whitespace. 2025-01-22 14:56:44 +01:00
Georgi Yanchev
64b1ac7292 Fixed #24529 -- Allowed double squashing of migrations.
Co-authored-by: Raphael Gaschignard <raphael@rtpg.co>
2025-01-22 10:56:30 +01:00
Georgi Yanchev
322785b08c Refs #24529 -- Added replace_migration hook to MigrationLoader. 2025-01-22 10:56:30 +01:00
Simon Charette
00c690efbc Fixed #36117 -- Raised ValueError when providing composite expressions to case / when.
Remove redundant Case and When.resolve_expression to delegate composite
expression support to BaseExpression.

Thanks Jacob Tyler Walls for the report and test.
2025-01-22 08:56:18 +01:00
Simon Charette
a76035e925 Refs #36042 -- Consolidated composite expression checks in BaseExpression.
Remove redundant Func.resolve_expression and adjust CombinedExpression to
delegate source expression resolving to super() to perform checks against
allows_composite_expressions in a single location.
2025-01-22 08:56:18 +01:00
Simon Charette
626d77e52a Fixed #36116 -- Optimized multi-column ForwardManyToOne prefetching.
Rely on ColPairs and TupleIn which support a single column to be specified
to avoid special casing ForwardManyToOne.get_prefetch_querysets().

Thanks Jacob Walls for the report.
2025-01-21 09:09:43 +01:00
Simon Charette
22fc151bb8 Fixed #36107 -- Adjusted UNNEST bulk_create strategy to opt-out sized arrays.
The array fields opt-out heuristic failed to account for sized arrays.

Note that we keep relying on db_type as opposed to performing an ArrayField
instance check against the column's field as there could be other
implementations of model fields that use Postgres arrays to store the
optimization must be disabled for all of them.

Refs #35936.

Thanks Claude Paroz for the report and test.
2025-01-20 14:15:32 +01:00
Mariusz Felisiak
f5772de696 Fixed #36005 -- Dropped support for Python 3.10 and 3.11. 2025-01-20 14:07:28 +01:00
greg
61dae11df5 Fixed #36017 -- Used EmailValidator in urlize to detect emails. 2025-01-20 09:50:29 +01:00
Anders Kaseorg
c28f821c90 Fixed broken link in django/core/handlers/asgi.py comment. 2025-01-18 13:09:10 +01:00
Tim Graham
d8f093908c Fixed #35448 -- Fixed formatting of test --debug-sql output.
Also adds DatabaseOperations.format_debug_sql() hook for backends
(e.g. NoSQL) to customize formatting.
2025-01-18 07:04:57 +01:00
Sarah Boyce
37373d9ae9 Increased the default PBKDF2 iterations for Django 6.0. 2025-01-15 22:28:37 +01:00