1
0
mirror of https://github.com/django/django.git synced 2025-06-21 11:29:12 +00:00

5066 Commits

Author SHA1 Message Date
Jacob Walls
8ede411a81 Fixed #36152 -- Deprecated use of "%" in column aliases.
Unintentional support existed only on SQLite and Oracle.
2025-06-20 08:25:22 +02:00
Clifford Gama
74b31cd26b Fixed #32770 -- Added system check to ensure django.contrib.postgres is installed when using its features.
Added postgres.E005 to validate 'django.contrib.postgres' is in INSTALLED_APPS
when using:
* PostgreSQL-specific fields (ArrayField, HStoreField, range fields, SearchVectorField),
* PostgreSQL indexes (PostgresIndex and all subclasses), and
* ExclusionConstraint

The check provides immediate feedback during system checks rather than failing
later with obscure runtime and database errors.

Thanks to Simon Charette and Sarah Boyce for reviews.
2025-06-18 08:36:49 +02:00
Clifford Gama
104cbfd44b Fixed #36453 -- Made When.condition resolve with for_save=False.
Value(None, JSONField()) when used in When.condition incorrectly resolved with
for_save=True, resulting in the value being serialized as SQL NULL instead of
JSON null.

Regression in c1fa3fdd040718356e5a3b9a0fe699d73f47a940.

Thanks to Thomas McKay for the report, and to David Sanders and Simon Charettes
for the review.

Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
2025-06-16 10:40:29 +02:00
Jake Howard
12c1557060 Fixed #36447 -- Selected preferred media type based on quality.
When matching which entry in the `Accept` header should be used for
a given media type, the specificity matters. However once those are
resolved, only the quality matters when selecting preference.

Regression in c075508b4de8edf9db553b409f8a8ed2f26ecead.

Thank you to Anders Kaseorg for the report.
2025-06-16 09:25:25 +02:00
Claude Paroz
f2f6046c0f Fixed #25706 -- Refactored geometry widgets to remove inline JavaScript.
Refactored GIS-related JavaScript initialization to eliminate inline
scripts from templates. Added support for specifying a base layer using
the new `base_layer_name` attribute on `BaseGeometryWidget`, allowing
custom map tile providers via user-defined JavaScript.

As a result, the `gis/openlayers-osm.html` template was removed.

Thanks Sarah Boyce for reviews.

Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2025-06-12 17:35:14 -03:00
Sarah Boyce
2714bc3f2c Added follow-up to CVE-2025-48432 to security archive. 2025-06-10 15:08:30 +02:00
Sarah Boyce
7fcc7b1a0c Added stub release notes for 5.2.4. 2025-06-10 12:29:28 +02:00
Natalia
cf5f36bf90 Fixed #36446 -- Restored "q" in internal MediaType.params property.
The "q" key was removed while addressing ticket #36411. Despite
`MediaType.params` is undocumented and considered internal, it was used
in third-party projects (Zulip reported breakage), so this work restored
the `q` key in `params`.

Thanks Anders Kaseorg for the report.

Regression in c075508b4de8edf9db553b409f8a8ed2f26ecead.
2025-06-09 17:37:40 -03:00
Clifford Gama
c1fa3fdd04 Fixed #36419 -- Ensured for_save was propagated when resolving expressions.
The for_save flag wasn't properly propagated when resolving expressions, which
prevented get_db_prep_save() from being called in some cases. This affected
fields like JSONField where None would be saved as JSON null instead of SQL NULL.

Regression in 00c690efbc0b10f67924687f24a7b30397bf47d9.

Thanks to David Sanders and Simon Charette for reviews.

Co-authored-by: Adam Johnson <me@adamj.eu>
2025-06-06 17:40:35 +02:00
Jake Howard
9579517552 Refs CVE-2025-48432 -- Prevented log injection in remaining response logging.
Migrated remaining response-related logging to use the `log_response()`
helper to avoid potential log injection, to ensure untrusted values like
request paths are safely escaped.

Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2025-06-06 09:05:32 -03:00
Sarah Boyce
b762a6ab3c Updated translations from Transifex.
Forwardport of 5901cfe591139b4389171ba738be81e8f4d5cfc9 from stable/5.2.x.
2025-06-06 13:57:27 +02:00
Natalia
51923c576a Added CVE-2025-48432 to security archive. 2025-06-04 10:57:51 -03:00
Natalia
1f19c36e2d Added stub release notes for 5.2.3. 2025-06-04 10:55:33 -03:00
Natalia
a07ebec559 Fixed CVE-2025-48432 -- Escaped formatting arguments in log_response().
Suitably crafted requests containing a CRLF sequence in the request
path may have allowed log injection, potentially corrupting log files,
obscuring other attacks, misleading log post-processing tools, or
forging log entries.

To mitigate this, all positional formatting arguments passed to the
logger are now escaped using "unicode_escape" encoding.

Thanks to Seokchan Yoon (https://ch4n3.kr/) for the report.

Co-authored-by: Carlton Gibson <carlton@noumenal.es>
Co-authored-by: Jake Howard <git@theorangeone.net>
2025-06-04 08:33:30 -03:00
Simon Charette
08187c94ed Fixed #36432 -- Fixed a prefetch_related crash on related target subclass queryset.
Regression in 626d77e52a3f247358514bcf51c761283968099c.

Refs #36116.

Thanks Cornelis Poppema for the excellent report.
2025-06-04 10:46:49 +02:00
Jake Howard
c075508b4d Fixed #36411 -- Made HttpRequest.get_preferred_type() consider media type parameters.
HttpRequest.get_preferred_type() did not account for parameters in
Accept header media types (e.g., "text/vcard; version=3.0"). This caused
incorrect content negotiation when multiple types differed only by
parameters, reducing specificity as per RFC 7231 section 5.3.2
(https://datatracker.ietf.org/doc/html/rfc7231.html#section-5.3.2).

This fix updates get_preferred_type() to treat media types with
parameters as distinct, allowing more precise and standards-compliant
matching.

Thanks to magicfelix for the report, and to David Sanders and Sarah
Boyce for the reviews.
2025-06-03 16:10:41 -03:00
Jacob Walls
26313bc219 Fixed #36416 -- Made QuerySet.in_bulk() account for composite pks in id_list. 2025-06-03 18:45:15 +03:00
Blayze
90429625a8 Fixed #36423 -- Prevented filter_horizontal buttons from intercepting form submission.
In the admin's filter_horizontal widget, optional action buttons like
"Choose all", "Remove all", etc. were changed from `<a>` to `<button>`
elements in #34619, but without specifying `type="button"`. As a result,
when pressing Enter while focused on a form input, these buttons could
be triggered and intercept form submission.

Explicitly set `type="button"` on these control buttons to prevent them
from acting as submit buttons.

Thanks Antoliny Lee for the quick triage and review.

Regression in 857b1048d53ebf5fc5581c110e85c212b81ca83a.
2025-06-02 22:25:14 -03:00
Natalia
1a74434399 Added stub release notes and release date for 5.2.2, 5.1.10, and 4.2.22. 2025-05-28 10:03:06 -03:00
Adam Johnson
c2615a0500 Fixed #36405 -- Fixed Aggregate.order_by using OuterRef.
co-authored-by: Simon Charette <charette.s@gmail.com>
2025-05-23 16:15:59 +02:00
Adam Johnson
b8e5a8a9a2 Fixed #36404 -- Fixed Aggregate.filter using OuterRef.
Regression in a76035e925ff4e6d8676c65cb135c74b993b1039.
Thank you to Simon Charette for the review.

co-authored-by: Simon Charette <charette.s@gmail.com>
2025-05-23 15:17:20 +02:00
Sarah Boyce
1704c49a9b Fixed #36390 -- Deprecated RemoteUserMiddleware subclasses missing aprocess_request().
Regression in 50f89ae850f6b4e35819fe725a08c7e579bfd099.
Thank you to shamoon for the report and Natalia Bidart for the review.
2025-05-23 10:22:36 +02:00
ontowhee
ddb8529415 Fixed #34262 -- Added support for AnyValue for SQLite, MySQL, Oracle, and Postgresql 16+.
Thanks Simon Charette for the guidance and review. Thanks Tim Schilling for the
documentation review. Thanks David Wobrock for investigation and solution proposals.
2025-05-20 10:01:42 +02:00
Jacob Walls
f603ece016
Fixed typo in docs/releases/6.0.txt. 2025-05-19 15:09:09 -03:00
Colleen Dunlap
802baf5da5 Fixed #36388 -- Made QuerySet.union() return self when called with no arguments.
Regression in 9cb8baa0c4fa2c10789c5c8b65f4465932d4d172.
Thank you to Antoine Humeau for the report and Simon Charette for the review.
2025-05-19 10:34:14 +02:00
Jacob Walls
994dc6d8a1 Fixed #36392 -- Raised ValueError when subquery referencing composite pk selects too many columns. 2025-05-16 08:19:38 +02:00
Pablo Bengoechea
87ab54b488 Fixed #35829 -- Updated admin icons using Font Awesome Free version 6.7.2.
Co-authored-by: Stefan <96178532+stefan6419846@users.noreply.github.com>
2025-05-15 09:09:27 -03:00
savanto
8620a3b0c7 Fixed #36085 -- Added JSONField support for negative array indexing on SQLite. 2025-05-14 13:21:18 +02:00
Adam Johnson
4647e2b866 Refs #36383 -- Extended DeconstructibleSerializer to support non-identifier keyword arguments.
In Python, keyword arguments must normally be valid identifiers (i.e.,
variable names that follow Python's naming rules). However, Python dicts
can have keys that aren't valid identifiers, like "foo-bar" or "123foo".

This commit ensures that keyword arguments that are nt valid
identifiers, are properly handled when deconstructing an object.
2025-05-13 21:42:19 -03:00
Simon Charette
8be0c0d690 Fixed #36373 -- Fixed select_related() crash on foreign object for a composite pk.
Thanks Jacob Walls for the report and Sarah for the in-depth review.
2025-05-12 12:33:07 +01:00
Natalia
42ab99309d Refs #35980 -- Added release note about changes in release artifacts filenames. 2025-05-09 13:29:19 -03:00
Natalia
c86156378d Removed "Expected" from release date for 5.2.1, 5.1.9, and 4.2.21. 2025-05-09 13:29:19 -03:00
Natalia
37f2a77c72 Cleaned up CVE-2025-32873 security archive description. 2025-05-07 11:36:05 -03:00
Natalia
fdabda4e05 Added CVE-2025-32873 to security archive. 2025-05-07 10:59:55 -03:00
Natalia
d8397bf6cd Added stub release notes for 5.2.2. 2025-05-07 10:56:00 -03:00
Sarah Boyce
9f3419b519 Fixed CVE-2025-32873 -- Mitigated potential DoS in strip_tags().
Thanks to Elias Myllymäki for the report, and Shai Berger and Jake
Howard for the reviews.

Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2025-05-06 22:21:42 -03:00
Natalia
0f5dd0dff3 Made cosmetic edits and added upcoming security release to release notes. 2025-04-30 14:55:12 -03:00
Baptiste Mispelon
66f9eb0ff1 Fixed #36357 -- Skipped unique_together in inspectdb output for composite primary keys.
Thanks to Baptiste Mispelon for the report and quick fix, and to Simon
Charette and Jacob Walls for the reviews.

Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2025-04-30 11:55:25 -03:00
Simon Charette
07100db6f4 Fixed #36358 -- Corrected introspection of composite primary keys on SQLite.
Previously, any first field of a composite primary key with type
`INTEGER` was incorrectly introspected as an `AutoField` due to SQLite
treating `INTEGER PRIMARY KEY` as an alias for the `ROWID`.

This change ensures that integer fields in composite PKs are not
mistaken for auto-incrementing fields.

Thanks Jacob Walls and Sarah Boyce for the reviews.
2025-04-30 10:51:48 -03:00
Simon Charette
8ef4e0bd42 Fixed #36360 -- Fixed QuerySet.update() crash when referring annotations through values().
The issue was only manifesting itself when also filtering againt a related
model as that forces the usage of a subquery because SQLUpdateCompiler doesn't
support the UPDATE FROM syntax yet.

Regression in 65ad4ade74dc9208b9d686a451cd6045df0c9c3a.

Refs #28900.

Thanks Gav O'Connor for the detailed report.
2025-04-30 10:38:19 +01:00
Bruno Alla
bc21bc4282 Fixed #18296 -- Created missing custom target directory for startproject and startapp. 2025-04-27 14:41:27 +01:00
nessita
0596263c31
Fixed #36309 -- Made email alternatives and attachments pickleable.
Regression in aba0e541caaa086f183197eaaca0ac20a730bbe4 and in
d5bebc1c26d4c0ec9eaa057aefc5b38649c0ba3b.

Thanks Florent Messa for the report, and Jake Howard and Claude
Paroz for the review.
2025-04-24 10:11:16 -03:00
nessita
c86242d61f
Refs #36341 -- Added release notes for 5.1.9 and 4.2.21 for fix in wordwrap template filter.
Revision 1e9db35836d42a3c72f3d1015c2f302eb6fee046 fixed a regression in
55d89e25f4115c5674cdd9b9bcba2bb2bb6d820b, which also needs to be
backported to the stable branches in extended support (5.1.x and 4.2.x).
2025-04-23 17:26:48 -03:00
Matti Pohjanvirta
1e9db35836 Fixed #36341 -- Preserved whitespaces in wordwrap template filter.
Regression in 55d89e25f4115c5674cdd9b9bcba2bb2bb6d820b.

This work improves the django.utils.text.wrap() function to ensure that
empty lines and lines with whitespace only are kept instead of being
dropped.

Thanks Matti Pohjanvirta for the report and fix.

Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2025-04-23 16:14:03 -03:00
antoliny0919
1bc805e23b Fixed #36331 -- Reverted "Fixed #36055 -- Prevented overlap of object-tools buttons and page header in the admin."
This reverts commits b1324a680add78de24c763911d0eefa19b9263bc and
02a5cbfe76382da2a0414df17017185be5bd47f9. The former caused a regression
in admin sites that relied on the `object-tools` block being inside the
`content` block.

Thank you to Fabian Braun for the report.
2025-04-22 22:13:38 -03:00
SaJH
1831f7733d Fixed #36326 -- Added CompositePrimaryKey support in QuerySet.raw().
Signed-off-by: SaJH <wogur981208@gmail.com>
2025-04-17 17:23:06 +02:00
Ahmed Nassar
d469db978e Fixed #36314 -- Fixed MinimumLengthValidator error message translation.
Regression in ec7d69035a408b357f1803ca05a7c991cc358cfa.

Thank you Gabriel Trouvé for the report and Claude Paroz for the review.
2025-04-17 12:30:20 +02:00
Ahmed Nassar
be402891cd Fixed #36311 -- Unified spelling of "hardcode" and its variants in docs.
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2025-04-15 14:48:55 -03:00
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
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