1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00
Commit Graph

13389 Commits

Author SHA1 Message Date
Adam Johnson
7abe5112f4 Fixed #35407 -- Cached model's Options.swapped. 2024-05-07 14:25:51 +02:00
Jacob Walls
ceea86baa3 Fixed #35425 -- Avoided INSERT with force_update and explicit pk.
Affected models where the primary key field is defined with a
default or db_default, such as UUIDField.
2024-05-07 12:15:27 +02:00
sobolevn
9a27c76021 Fixed #35426 -- Updated querysets to be a required argument of GenericPrefetch. 2024-05-04 11:30:36 +02:00
Mariusz Felisiak
91a4b9a8ec Fixed #35422 -- Fixed migrations crash when altering GeneratedField referencing rename field.
Thanks Sarah Boyce for the report and Simon Charette for the
implementation idea.
2024-05-03 09:28:24 +02:00
DevilsAutumn
9aeb38c296 Fixed #35359 -- Fixed migration operations ordering when adding fields referenced by GeneratedField.expression.
Thank you to Simon Charette for the review.
2024-05-02 21:43:13 -03:00
David Sanders
97d48cd3c6 Refs #34007, Refs #35359 -- Added Q.referenced_based_fields property.
Thank you to Mariusz Felisiak and Natalia Bidart for the reviews.
2024-05-02 19:05:13 +02:00
Sarah Boyce
39828fa778 Added a high contrast mode to screenshot cases.
Thank you to Sarah Abderemane and Nick Pope for the reviews.
2024-05-02 13:18:58 +02:00
David Smith
c187f5f924 Refs #32819 -- Avoided adding 'aria-describedby' to hidden inputs.
Hidden elements are not visible for both accessibility tools and browsers presentation layer. This change therefore only reduces the size of the generated HTML.
2024-04-30 11:11:02 +02:00
Mariusz Felisiak
85c154da2f Fixed #35412 -- Dropped support for SQLite < 3.31. 2024-04-29 11:07:54 +02:00
Chris Muthig
c8df2f9941 Fixed #35339 -- Fixed PostgreSQL aggregate's filter and order_by params order.
Updated OrderableAggMixin.as_sql() to separate the order_by parameters
from the filter parameters. Previously, the parameters and SQL were
calculated by the Aggregate parent class, resulting in a mixture of
order_by and filter parameters.

Thanks Simon Charette for the review.
2024-04-25 17:40:03 -03:00
Chris Muthig
42b567ab4c Refs #35339 -- Updated Aggregate class to return consistent source expressions.
Refactored the filter and order_by expressions in the Aggregate class to
return a list of Expression (or None) values, ensuring that the list
item is always available and represents the filter expression.
For the PostgreSQL OrderableAggMixin, the returned list will always
include the filter and the order_by value as the last two elements.

Lastly, emtpy Q objects passed directly into aggregate objects using
Aggregate.filter in admin facets are filtered out when resolving the
expression to avoid errors in get_refs().

Thanks Simon Charette for the review.
2024-04-25 17:40:03 -03:00
Tim Richardson
e64d42e753 Fixed #35395 -- slice filter crashes on an empty dict with Python 3.12.
Keep consistent behaviour of slice() filter between python 3.12 and prior
versions in the case of a dict passed to the filter (catch the new to python
3.12 KeyError exception).
2024-04-24 10:53:38 +02:00
Simon Charette
83f5478225 Fixed #35356 -- Deferred self-referential foreign key fields adequately.
While refs #34612 surfaced issues with reverse one-to-one fields
deferrals, it missed that switching to storing remote fields would break
self-referential relationships.

This change switches to storing related objects in the select mask
instead of remote fields to prevent collisions when dealing with
self-referential relationships that might have a different directional
mask.

Despite fixing #21204 introduced a crash under some self-referential
deferral conditions, it was simply not working even before that as it
aggregated the sets of deferred fields by model.

Thanks Joshua van Besouw for the report and Mariusz Felisiak for the
review.
2024-04-23 13:17:17 -03:00
Marijke Luttekes
2be37b2533 Made SeleniumTests.test_inline_add_another_widgets less flaky by adding explicit wait. 2024-04-17 17:38:04 +02:00
Simon Charette
d048f0d311 Fixed #35373 -- Fixed a crash when indexing a generated field on SQLite.
Generated fields have to be excluded from the INSERT query against the remade
table including the index.

Thanks Moshe Dicker for the report, David Sanders and Mariusz Felisiak for the
review.
2024-04-16 17:27:38 +02:00
Adam Johnson
50a702f3fd Fixed #35364 -- Stopped AdminEmailHandler rendering email unnecessarily. 2024-04-12 10:37:28 +02:00
Adam Johnson
b0f2289426 Refs #35364 -- Tested AdminEmailHandler with empty ADMINS. 2024-04-12 10:37:28 +02:00
Simon Charette
73b62a2126 Refs #35194 -- Adjusted a generated field test to work on Postgres 15.6+.
Postgres >= 12.18, 13.14, 14.11, 15.6, 16.2 changed the way the immutability
of generated and default expressions is detected in postgres/postgres@743ddaf.

The adjusted test semantic is presereved by switching from __icontains to
__contains as both make use of a `%` literal which requires proper escaping.

Refs #35336.

Thanks bcail for the report.
2024-04-12 10:23:04 +02:00
Sarah Boyce
f973a70bfc
Made postgresql.tests.Tests.test_connect_pool less flaky by increasing timeout value. 2024-04-10 14:09:52 -03:00
Natalia
338ec052b4 Refs #35361 -- Added test for Email line length checks when dealing with surrogate pairs.
Refs #33173, #34118 and #34900.
2024-04-10 17:56:55 +02:00
Sarah Boyce
8b53560eea Fixed #35350 -- Fixed save() with pk set on models with GeneratedFields.
Thanks Matt Hegarty for the report and Simon Charette and Natalia Bidart for the reviews.

Regression in f333e35.
2024-04-10 15:43:50 +02:00
Carlton Gibson
bcd255cd5c Fixed #35354 -- Simplified ASGIRequest path handling.
Following the ASGI HTTP Connection Scope docs[0], the provided `path`
is already the correct value that Django requires.

In combination with `root_path`, from which `script_name` is derived,
the `path_info` variable is set. It's then redundant to
re-calculate `path` from `script_name` and `path_info`.

See also, a clarifying discussion on the ASGIref repo[1].

[0]: https://asgi.readthedocs.io/en/latest/specs/www.html#http-connection-scope
[1]: https://github.com/django/asgiref/issues/424
2024-04-05 11:35:38 +02:00
Carlton Gibson
4d2ef9bb82 Refs #35169 -- Added test for ASGIRequest root_path handling. 2024-04-05 11:30:33 +02:00
Sarah Boyce
89403dbedd Fixed SeleniumTests.test_related_object_update_with_camel_casing() assert.
A selenium web element was compared to a string rather than its innerHTML.
2024-04-03 09:29:01 +02:00
devin13cox
8665cf03d7
Fixed #35330 -- Fixed the update of related widgets when the referenced model is camel case named.
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2024-04-02 22:00:25 -03:00
Simon Charette
888b9042b3
Fixed #35336 -- Addressed crash when adding a GeneratedField with % literals.
A longer term solution is likely to have a better separation of parametrized
DDL altogether to handle checks, constraints, defaults, and generated fields
but such a change would require a significant refactor that isn't suitable
for a backport.

Thanks Adrian Garcia for the report.
2024-04-02 17:33:31 -03:00
Johannes Westphal
5f18021640 Fixed #35344, Refs #34838 -- Corrected output_field of resolved columns for GeneratedFields in aliased tables.
Thanks Simon Charette for the review.
2024-04-01 18:54:38 +01:00
Fabian Braun
944745afe2 Fixed #34977 -- Improved accessibility in the UserChangeForm by replacing the reset password link with a button.
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2024-03-27 16:40:41 -03:00
Giannis Terzopoulos
d658a3162f Fixed #35233 -- Moved template engine system checks to backend methods.
Thanks Adam Johnson for reviews.
2024-03-27 08:14:54 +01:00
Mariusz Felisiak
b98271a6e4
Fixed #35329 -- Fixed migrations crash when adding partial unique constraints with nulls_distinct.
Bug in 595a2abb58.

Thanks Lucas Lemke Saunitti for the report.
2024-03-26 22:58:47 +01:00
Mariusz Felisiak
a2dcc4ecbb
Increased test coverage for django.db.migrations.operations.special. 2024-03-25 08:31:32 +01:00
Ben Cail
07c8d979ae Fixed #35323 -- Prevented file_move_safe() from trying to overwrite existing file when allow_overwrite is False. 2024-03-24 16:05:36 +01:00
Mariusz Felisiak
1c11dba835
Added ModelState.from_model() test for abstract model with unnamed indexes. 2024-03-22 13:31:33 +01:00
sharonwoo
6a37e9bfae Fixed #35257 -- Corrected resolving output_field for IntegerField/DecimalField with NULL. 2024-03-21 10:13:54 +01:00
Mariusz Felisiak
6f7c0a4d66
Fixed ResourceWarning from unclosed SQLite connection in test_utils on Python 3.13+.
On SQLite, close() doesn't explicitly close in-memory connections.

Follow up to 921670c694 and
dd45d5223b.
2024-03-20 11:44:30 +01:00
Laurent Lyaudet
f2388a4b73 Fixed #35309 -- Made prefetch clear ordering for single-valued relationships. 2024-03-20 05:26:18 +01:00
Mariusz Felisiak
921670c694
Fixed ResourceWarning from unclosed SQLite connection on Python 3.13+.
On SQLite, close() doesn't explicitly close in-memory connections.

Follow up to dd45d5223b.
2024-03-19 10:03:12 +01:00
Claude Paroz
10b31eea33 Refs #31014 -- Added srid argument to FromWKB/FromWKT() GIS functions. 2024-03-18 09:45:33 +01:00
Adam Johnson
7646b9023d
Fixed #35301 -- Fixed Options._property_names for overriden properties.
Regression in faeb92ea13.
2024-03-17 09:43:04 +01:00
Adam Johnson
cbf1e87398 Fixed #35294 -- Fixed TEXT format of QuerySet.explain() for long plans.
co-authored-by: Gordon <gordon.wrigley@gmail.com>
co-authored-by: Simon Charette <charette.s@gmail.com>
2024-03-15 06:58:14 +01:00
Ben Cail
593067a8ee Fixed #28541 -- Fixed migrations crash when changing primary key on SQLite. 2024-03-14 20:56:43 +01:00
Johannes Maron
3d7235c67b Refs #34488 -- Made ClearableFileInput preserve "Clear" checked attribute when form is invalid. 2024-03-14 14:03:14 +01:00
Johannes Maron
e69019555d Fixed #35273 -- Fixed rendering AdminFileWidget's attributes.
Regression in 8a6c0203c4.
2024-03-14 14:03:09 +01:00
Jon Janzen
f5c340684b Fixed #34901 -- Added async-compatible interface to session engines.
Thanks Andrew-Chen-Wang for the initial implementation which was posted
to the Django forum thread about asyncifying contrib modules.
2024-03-13 17:55:15 +01:00
Mariusz Felisiak
33c06ca0da
Refs #32673, Refs #35295 -- Avoided wrapping rhs direct values in lookups. 2024-03-13 17:46:37 +01:00
Claude Paroz
894fa55da1
Applied BoundingCircle test to only one country.
Looks like testing the second Country is much more computing-intensive
and brings nothing to the test.
2024-03-10 20:59:36 +01:00
Giannis Terzopoulos
73df8b54a2 Fixed #35044 -- Avoided clearing reverse relations and private fields when accessing deferred fields.
Regression in a7b5ad8b19 for reverse
relations and possibly in 123b1d3fcf for
private fields.
2024-03-08 11:09:54 +01:00
Giannis Terzopoulos
0c690c6001 Refs #35044 -- Added Model.refresh_from_db(fields=...) test for clearing reverse relations. 2024-03-08 10:27:19 +01:00
Ben Cail
1570ef02f3 Fixed #35223 -- Made Model.full_clean() ignore fields with db_default when validating empty values.
Thanks Brian Ibbotson for the report.

Regression in 7414704e88.
2024-03-08 05:55:25 +01:00
Dingning
549320946d Fixed #35030 -- Made django.contrib.auth decorators to work with async functions. 2024-03-07 09:59:33 +01:00