1
0
mirror of https://github.com/django/django.git synced 2025-04-15 04:44:37 +00:00

13871 Commits

Author SHA1 Message Date
Simon Charette
21f8be76d4 Fixed #36288 -- Addressed improper handling of duplicates in values_list().
Now that selected aliases are stored in sql.Query.selected: dict[str, Any]
the values_list() method must ensures that duplicate field name references are
assigned unique aliases.

Refs #28900.

Regression in 65ad4ade74dc9208b9d686a451cd6045df0c9c3a.

Thanks Claude for the report.
2025-04-11 09:04:49 +02:00
Andrew
2d1ac1dce8
Refs #36036 -- Removed unsupported 4D GEOS tests. 2025-04-09 22:40:55 -03:00
Ahmed Nassar
522dd021b2 Fixed #35986 -- Fixed test classes with @translation.override decorator.
Co-authored-by: Simon Charette <charette.s@gmail.com>
2025-04-09 09:49:14 +02:00
Mike Edmunds
a627829e7b Refs #35581 -- Updated mail tests to include trailing newlines.
Python's modern email API will force a trailing newline onto all text/*
bodies and attachments. Updated mail tests to include (and check for)
the newline while still using the legacy email API.

See https://github.com/python/cpython/issues/121515 which reasons that,
apart from artificial test cases, most text content already ends in a
newline. If it doesn't, adding one won't change the meaning.
2025-04-09 09:46:10 +02:00
Simon Charette
71a19a0e47 Fixed #36301 -- Fixed select_for_update(of) crash when using values()/values_list().
Regression in 65ad4ade74dc9208b9d686a451cd6045df0c9c3a which allowed for
annotations to be SELECT'ed before model field references through
values()/values_list() and broke assumptions the select_for_update(of)
table infererence logic had about model fields always being first.

Refs #28900.

Thanks OutOfFocus4 for the report and Sarah for the test.
2025-04-07 22:56:40 +02:00
Sarah Boyce
8ad3e80e88 Fixed #36298 -- Truncated the overwritten file content in file_move_safe().
Regression in 58cd4902a71a3695dd6c21dc957f59c333db364c.

Thanks Baptiste Mispelon for the report.
2025-04-07 16:11:36 +02:00
Mariusz Felisiak
d4a2809c2b
Added supports_expression_defaults check in DefaultTests.test_full_clean() test. 2025-04-06 09:40:12 +02:00
Simon Charette
12b771a1ec Fixed #36299 -- Prevented field selection on QuerySet.alias() after values().
Regression in 65ad4ade74dc9208b9d686a451cd6045df0c9c3a.

Refs #28900.

Thanks Jeff Iadarola for the report and tests.

Co-Authored-By: OutOfFocus4 <jeff.iadarola@gmail.com>
2025-04-05 20:43:50 +02:00
Kelvin Adigwu
25f97e7bcf
Fixed #36156 -- Added supports_json_field check in test_db_default_output_field_resolving test. 2025-04-05 18:54:08 +02:00
Tim Graham
02e7a162a0
Refs #36088, Refs #36260 - Added supports_expression_defaults checks in bulk_create() tests. 2025-04-05 18:47:53 +02:00
Simon Charette
764af7a3d6 Fixed #36289 -- Fixed bulk_create() crash with nullable geometry fields on PostGIS.
Swapped to an allow list instead of a deny list for field types to
determine if the UNNEST optimization can be enabled to avoid further
surprises with other types that would require further specialization to
adapt.

Regression in a16eedcf9c69d8a11d94cac1811018c5b996d491.

Thanks Joshua Goodwin for the report and Sarah Boyce for the test.
2025-04-04 21:33:04 +02:00
koffi
019acad112 Fixed #36255 -- Renamed the admin action button for improved accessibility. 2025-04-04 17:41:13 +02:00
Simon Charette
f7f38f3a0b Fixed #36290 -- Made TupleIn() lookup discard tuples containing None.
Just like the In() lookup discards of None members TupleIn() should
discard tuples containing any None as NULL != NULL in SQL and the
framework expects such queries to be elided under some circumstances.

Refs #31667, #36116.

Thanks Basptise Mispelon for bisecting the regression to 626d77e.
2025-04-03 20:40:43 +02:00
Simon Charette
543e17c440 Fixed #36292 -- Fixed crash when aggregating over a group mixing transforms and references.
Regression in 65ad4ade74dc9208b9d686a451cd6045df0c9c3a.

Refs #28900

Thanks Patrick Altman for the report.
2025-04-03 17:51:26 +02:00
Sarah Boyce
39e2297210 Fixed CVE-2025-27556 -- Mitigated potential DoS in url_has_allowed_host_and_scheme() on Windows.
Thank you sw0rd1ight for the report.
2025-04-02 10:21:33 +02:00
Ahmed Nassar
00c68f03b5 Fixed #36267 -- Fixed contenttypes shortcut() view crash with an invalid object_id for a UUIDField pk. 2025-04-02 09:33:13 +02:00
Jacob Walls
a0fb35eb72 Fixed #36184 -- Allowed migrating forward to squashed migrations. 2025-04-01 09:35:37 +02:00
Anthony Joseph
6888375c53 Fixed #22977 -- Added system check for clashing managers and reverse related fields.
With thanks to  Konrad Świat, Loïc Bistuer, Russell Keith-Magee,
and Mariusz Felisiak.

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2025-03-31 22:20:43 +02:00
Song Junho
126417be43 Fixed #36265 -- Added support for serialization of ZoneInfo instances in migrations. 2025-03-31 13:44:54 +02:00
Mariusz Felisiak
281910ff8e
Fixed warnings per flake8 7.2.0.
https://github.com/PyCQA/flake8/releases/tag/7.2.0
2025-03-30 17:54:15 +02:00
saJaeHyukc
c1a4fccf53 Fixed #36239 -- Fixed a crash in ManyToManyField.through_fields check when to model is invalid.
Signed-off-by: saJaeHyukc <wogur981208@gmail.com>
2025-03-28 12:37:57 +01:00
antoliny0919
849f8307a5 Fixed #34917 -- Underlined links in the main content area of the admin. 2025-03-27 13:27:33 +01:00
Khudyakov Artem
9aabe7eae3 Fixed #35440 -- Simplified parse_header_parameters by leveraging stdlid's Message.
The `parse_header_parameters` function historically used Python's `cgi`
module  (now deprecated). In 34e2148fc725e7200050f74130d7523e3cd8507a,
the logic was inlined to work around this deprecation ( #33173). Later,
in d4d5427571b4bf3a21c902276c2a00215c2a37cc, the header parsing logic
was further cleaned up to align with `multipartparser.py` (#33697).

This change takes it a step further by replacing the copied `cgi` logic with
Python's `email.message.Message` API for a more robust and maintainable header
parsing implementation.

Thanks to Raphael Gaschignard for testing, and to Adam Johnson and Shai
Berger for reviews.

Co-authored-by: Ben Cail <bcail@crossway.org>
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2025-03-27 08:57:03 -03:00
Clifford Gama
d5c19f9b32 Fixed #34819 -- Made GenericForeignKey prefetching use matching pk representations.
Ensured that rel_obj_attr and instance_attr return matching (pk, cls) tuples
in GenericForeignKey.get_prefetch_queryset(), preventing mismatches when
prefetching related objects where pk and get_prep_value() differ. Using
value_to_string() also makes this code compatible with composite primary keys.
2025-03-26 09:55:38 +01:00
Dmitry Shachnev
77b4ecbd53 Fixed #36260 -- Made bulk_create() work with DB-generated primary keys.
Co-authored-by: Simon Charette <charette.s@gmail.com>
2025-03-26 09:55:09 +01:00
Giannis Terzopoulos
a39c28706a Fixed #35529 -- Added support for positional arguments in querystring template tag.
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2025-03-25 12:23:41 -03:00
Jason Cameron
9608678704 Fixed #36262 -- Made GeneratedField.db_persist a required key-word argument. 2025-03-25 12:50:24 +01:00
wookkl
334677ad57 Fixed #35452 -- Deprecated orphans being more than or equal to page_size in pagination. 2025-03-25 12:04:13 +01:00
Tim Graham
fecca298a2 Fixed #36276 -- Omitted size=None from ArrayField.deconstruct(). 2025-03-25 12:02:14 +01:00
YogyaChugh
7164f08047 Fixed #36271 -- Raised TemplateSyntaxError when using a relative template path with an unknown origin. 2025-03-24 17:05:58 +01:00
Natalia
0b4f2d8d39 Fixed #36268 -- Added leading ? in every querystring template tag result.
Thanks Sarah Boyce for the report.
2025-03-24 11:53:42 -03:00
Natalia
639eafbd27 Ensured consistency in naming in template_tests/syntax_tests/test_querystring.py. 2025-03-24 11:53:42 -03:00
Johanan Oppong Amoateng
5adadf6e8c Fixed #36266 -- Renamed HIDE_PRODUCTION_WARNING environment variable to DJANGO_RUNSERVER_HIDE_WARNING. 2025-03-21 10:19:36 +01:00
Mike Edmunds
e295033144 Fixed #36138 -- Changed ADMINS and MANAGERS settings to lists of strings.
Previously, the ADMINS and MANAGERS settings were lists of (name, address)
tuples (where the name had been unused). Deprecated use of tuples.

Updated settings value sanity checks, and changed from ValueError to
ImproperlyConfigured.
2025-03-21 10:17:57 +01:00
Ahmed Nassar
ec7044c706 Fixed #36000 -- Deprecated HTTP as the default protocol in urlize and urlizetrunc. 2025-03-19 14:28:42 +01:00
Sarah Boyce
8f400a7ff0 Made selenium tests less flaky by waiting until popups are closed and page is loaded. 2025-03-18 10:52:01 +01:00
Mike Edmunds
62ad970c39 Refs #36138 -- Improved tests for mail_admins() and mail_managers().
- Separated MailTests.test_connection_arg test cases.
- Expanded test cases for incorrect values of ADMINS/MANAGERS settings.
- Added test case verifying correct values of ADMINS/MANAGERS settings.
2025-03-18 10:08:09 +01:00
fowczrek
6a9db1e626 Fixed #34865 -- Released memory earlier than garbage collection on database wrapping layers.
Thank you Florian Apolloner, Jake Howard and Patryk Zawadzki for
the clarifying comments and reviews.
2025-03-17 18:28:20 -03:00
hesham942
e804a07d76 Fixed #36252 -- Handled duplicate automatic imports in the shell command. 2025-03-17 16:29:28 -03:00
Mariusz Felisiak
1823a80113 Fixed #33537 -- Made test database cloning on MySQL reraise unexpected errors.
Thanks Faakhir Zahid and Stephen Finucane for the initial patch.

Thanks Simon Charette for the review.
2025-03-17 15:45:08 +01:00
Mariusz Felisiak
e7a9d756ee
Refs #35945 -- Fixed test_paginating_unordered_queryset_raises_warning_async() test on byte-compiled Django. 2025-03-13 11:06:44 +01:00
Adam Johnson
27b68bcadf Fixed #36234 -- Restored single_object argument to LogEntry.objects.log_actions().
Thank you Adam Johnson for the report and fix. Thank you Sarah Boyce for
your spot on analysis.

Regression in c09bceef68e5abb79accedd12dade16aa6577a09, which is
partially reverted in this branch.

Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
2025-03-12 16:25:28 -03:00
wookkl
2ae3044d9d Fixed #35945 -- Added async interface to Paginator. 2025-03-12 09:22:44 +01:00
Clifford Gama
0ebea6e5c0 Fixed #35676 -- Made BaseModelForm validate constraints that reference an InlineForeignKeyField.
Co-authored-by: Simon Charette <charette.s@gmail.com>
2025-03-12 09:16:15 +01:00
haileyajohnson
5183f7c287
Fixed #35816 -- Handled parsing of scientific notation in DTL. (#19213)
* Refs #35816 -- Improved test coverage of FilterExpression.

* Fixed #35816 -- Made FilterExpression parse scientific numbers.

---------

Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
2025-03-11 08:02:27 +01:00
Tom Carrick
8df5ce80d2
Fixed #36177 -- Added a trailing newline to JSON serializer. (#19232) 2025-03-11 08:01:06 +01:00
Simon Charette
ab148c02ce Fixed #33579 -- Specialized exception raised on forced update failures.
Raising DatabaseError directly made it harder than it should to
differentiate between IntegrityError when a forced update resulted in no
affected rows.

Introducing a specialized exception allows for callers to more easily
silence, log, or turn them update failures into user facing exceptions
(e.g. 404s).

Thanks Mariusz for the review.
2025-03-10 21:09:15 +01:00
saJaeHyukc
c1257350ca Fixed #36222 -- Fixed ExclusionConstraint validation crash on excluded fields in condition.
Signed-off-by: saJaeHyukc <wogur981208@gmail.com>
2025-03-10 20:11:01 +01:00
saJaeHyukc
f480d5d3ed Fixed #36201 -- Caught ValidationError in ModelChoiceField/ModelMultipleChoiceField.clean().
Signed-off-by: saJaeHyukc <wogur981208@gmail.com>
2025-03-10 13:01:02 +01:00
petr.prikryl
2a5aca38bb Fixed #35487 -- Removed CASCADE from RemoveField() on PostgreSQL.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Co-authored-by: Adam Johnson <me@adamj.eu>
Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
2025-03-09 11:50:17 +01:00