Commit graph

14016 commits

Author SHA1 Message Date
Jacob Walls
8914f4703c Fixed #35972 -- Fixed lookup crashes after subquery annotations.
Some checks are pending
Docs / docs (push) Waiting to run
Docs / blacken-docs (push) Waiting to run
Linters / flake8 (push) Waiting to run
Linters / isort (push) Waiting to run
Linters / black (push) Waiting to run
Tests / Windows, SQLite, Python 3.13 (push) Waiting to run
Tests / JavaScript tests (push) Waiting to run
2025-08-04 10:14:01 +02:00
Simon Charette
079d31e698 Fixed #34871, #36518 -- Implemented unresolved lookups expression replacement.
This allows the proper resolving of lookups when performing constraint
validation involving Q and Case objects.

Thanks Andrew Roberts for the report and Sarah for the tests and review.
2025-08-04 09:22:53 +02:00
Mariusz Felisiak
500bd42b96
Refs #35844 -- Readded optional requirements on daily builds for Python 3.14.
Some checks failed
Linters / flake8 (push) Has been cancelled
Linters / isort (push) Has been cancelled
Linters / black (push) Has been cancelled
Tests / Windows, SQLite, Python 3.13 (push) Has been cancelled
Tests / JavaScript tests (push) Has been cancelled
2025-08-01 09:43:22 +02:00
antoliny0919
6ea3319079 Fixed #36511 -- Ensured filters came before table in keyboard navigation in admin changelist.
Some checks failed
Linters / black (push) Waiting to run
Linters / flake8 (push) Waiting to run
Linters / isort (push) Waiting to run
Tests / Windows, SQLite, Python 3.13 (push) Waiting to run
Tests / JavaScript tests (push) Waiting to run
Docs / docs (push) Has been cancelled
Docs / blacken-docs (push) Has been cancelled
2025-07-30 17:32:39 +02:00
antoliny0919
792ca148a2 Fixed #36528, Refs #34917 -- Removed role="button" from object-tools links.
Regression in 849f8307a5.
In order to prevent underlines on links styled like buttons, role="button" was added.
This has been removed and the style updated to reflect that these are links.
2025-07-30 15:36:56 +02:00
antoliny0919
94c2f3b993 Fixed #36055 -- Prevented overlap of object-tools buttons and page header in the admin. 2025-07-30 11:09:45 +02:00
Mariusz Felisiak
d55979334d Fixed #36531 -- Added forkserver support to parallel test runner.
Some checks are pending
Docs / docs (push) Waiting to run
Docs / blacken-docs (push) Waiting to run
Linters / flake8 (push) Waiting to run
Linters / isort (push) Waiting to run
Tests / Windows, SQLite, Python 3.13 (push) Waiting to run
Linters / black (push) Waiting to run
Tests / JavaScript tests (push) Waiting to run
2025-07-29 14:11:22 -03:00
mriduldhall
d4dd3e503c Fixed #36519 -- Made center template filter consistent for even/odd padding.
Some checks are pending
Docs / docs (push) Waiting to run
Docs / blacken-docs (push) Waiting to run
Linters / flake8 (push) Waiting to run
Linters / isort (push) Waiting to run
Linters / black (push) Waiting to run
Tests / Windows, SQLite, Python 3.13 (push) Waiting to run
Tests / JavaScript tests (push) Waiting to run
Refactored `center` template filter to match f-string behaviour,
producing consistent padding for both odd and even fillings.

Thanks Lily Acorn for the report and Natalia Bidart for the review.

Co-authored-by: Lily Acorn <code@lilyf.org>
2025-07-28 16:41:06 -03:00
mriduldhall
2d4ca62170 Added test for various widths in tests/template_tests/filter_tests/test_center.py. 2025-07-28 16:41:06 -03:00
Simon Charette
0a4999b422 Fixed #36522 -- Added support for filtering composite pks using a tuple of expressions.
Thanks Jacob Walls for the report, and Sarah Boyce and Mariusz Felisiak
for reviews.
2025-07-28 16:39:28 -03:00
Clifford Gama
45ba7683a6 Refs #36438 -- Made FieldOperation.references_field() detect references in GeneratedField.expression.
Some checks failed
Linters / flake8 (push) Has been cancelled
Linters / isort (push) Has been cancelled
Linters / black (push) Has been cancelled
Docs / docs (push) Has been cancelled
Docs / blacken-docs (push) Has been cancelled
Tests / Windows, SQLite, Python 3.13 (push) Has been cancelled
Tests / JavaScript tests (push) Has been cancelled
Thanks to Simon Charette for the suggestion and review.
2025-07-25 13:59:13 +02:00
Clifford Gama
1a7fc0f65d Fixed #36438 -- Made MigrationAutodetector remove generated fields before their base fields.
Thanks to Colton Saska for the report and to Simon Charette for the review.
2025-07-25 13:59:13 +02:00
Mike Edmunds
9ab1991689 Fixed #35581 -- Updated django.core.mail to Python's modern email API.
- Changed EmailMessage.message() to construct a "modern email API"
  email.message.EmailMessage and added policy keyword arg.
- Added support for modern MIMEPart objects in EmailMessage.attach()
  (and EmailMessage constructor, EmailMessage.attachments list).
- Updated SMTP EmailBackend to use modern email.policy.SMTP.

Deprecated:
- Attaching MIMEBase objects (replace with MIMEPart)
- BadHeaderError (modern email uses ValueError)
- SafeMIMEText, SafeMIMEMultipart (unnecessary for modern email)
- django.core.mail.forbid_multi_line_headers()
  (undocumented, but exposed via `__all__` and in wide use)
- django.core.mail.message.sanitize_address()
  (undocumented, but in wide use)

Removed without deprecation (all undocumented):
- EmailMessage.mixed_subtype
- EmailMultiAlternatives.alternative_subtype
- Support for setting (undocumented) EmailMessage.encoding property
  to a legacy email.charset.Charset object

Related changes:
- Dropped tests for incorrect RFC 2047 encoding of non-ASCII email
  address localparts. This is specifically prohibited by RFC 2047, and
  not supported by any known MTA or email client. (Python still
  mis-applies encoded-word to non-ASCII localparts, but it is a bug that
  may be fixed in the future.)
- Added tests that try to discourage using Python's legacy email APIs
  in future updates to django.core.mail.
2025-07-25 13:50:02 +02:00
Mike Edmunds
20c62199ff Refs #35581 -- Added missing test for lazy email headers.
EmailMessage is intended to support lazy strings in any header field
(via coercion to `str` in forbid_multi_line_headers() called from
SafeMIMEMessage/Text/Multipart.__setitem__).
2025-07-25 13:50:02 +02:00
antoliny0919
d90bea1b06 Fixed #36516, Refs #36366 -- Fixed changelist footer layout with list_editable and list_filter.
Regression in 3f59711581.
2025-07-24 08:38:43 +02:00
Mike Edmunds
78298b5162 Refs #36500 -- Corrected rewrapped long lines fixed via a script.
Manually reformatted some comments and docstrings where autofix_w505.py
changed the meaning of the formatting.
2025-07-23 20:17:55 -03:00
django-bot
69a93a88ed Refs #36500 -- Rewrapped long docstrings and block comments via a script.
Rewrapped long docstrings and block comments to 79 characters + newline
using script from https://github.com/medmunds/autofix-w505.
2025-07-23 20:17:55 -03:00
Mike Edmunds
55b0cc2131 Refs #36500 -- Shortened some long docstrings and comments.
Manually reformatted some long docstrings and comments that would be
damaged by the to-be-applied autofixer script, in cases where editorial
judgment seemed necessary for style or wording changes.
2025-07-23 20:17:55 -03:00
Sarah Boyce
1ecf6889ca Removed double spaces after periods and within phrases.
Some checks are pending
Docs / docs (push) Waiting to run
Docs / blacken-docs (push) Waiting to run
Linters / flake8 (push) Waiting to run
Linters / isort (push) Waiting to run
Linters / black (push) Waiting to run
Tests / Windows, SQLite, Python 3.13 (push) Waiting to run
Tests / JavaScript tests (push) Waiting to run
2025-07-23 10:09:43 -03:00
David Smith
d0113c1711 Refs #36009 -- Adjusted gis_tests.geoapp.tests.GeoLookupTest.test_relate_lookup for bug in PostGIS.
ST_Relate() with PostGIS 3.5 and GEOS 3.13 gives a different result when
a series of calls are made vs. single call of the same function.

The fix for this is expected to be released in PostGIS 3.5.4 and 3.6.0.

https://lists.osgeo.org/pipermail/postgis-devel/2025-July/030581.html
https://trac.osgeo.org/postgis/ticket/5938
2025-07-23 08:17:18 -03:00
Mike Edmunds
0f5b573d3d Fixed incorrectly concatenated string in SimpleBlockTagTests.test_simple_block_tag_with_context_missing_content(). 2025-07-22 13:36:01 +02:00
Roel Delos Reyes
78fac1b047 Fixed #36226 -- Accepted str or bytes for password and salt in password hashers.
Co-authored-by: Screamadelica <1621456391@sjtu.edu.cn>
2025-07-22 12:15:10 +02:00
Take Weiland
e709301000 Fixed #36282 -- Used prefetched values in ForwardManyToOneDescriptor from indirect ancestors.
When looking for cached values in ManyRelatedManager and
ForwardManyToOneDescriptor walk up the whole chain of ancestors
(as long as they are cached) to find the prefetched relation.
2025-07-22 12:14:20 +02:00
Anthony Sottile
5488530a27 Fixed #36377 -- Added hints support to CreateExtension and subclasses. 2025-07-22 08:04:55 +02:00
David Smith
14fc2e9703 Improved consistency of GEOS error messages.
Some checks are pending
Linters / flake8 (push) Waiting to run
Linters / isort (push) Waiting to run
Linters / black (push) Waiting to run
Tests / Windows, SQLite, Python 3.13 (push) Waiting to run
Tests / JavaScript tests (push) Waiting to run
2025-07-21 22:23:29 -03:00
David Smith
414253866b Improved iteration of geometries in GEOS tests. 2025-07-21 22:23:29 -03:00
David Smith
49cb481f3d Added message to TypeError exceptions in GEOS WKTReader and WKBReader. 2025-07-21 22:23:29 -03:00
David Smith
ef42718a2b Used assertRaisesMessage and subTest where appropriate in GEOS tests. 2025-07-21 22:23:29 -03:00
Ahmed Ibrahim
a5b0a618c3 Fixed #28696 -- Added GeometryType GIS database function and __geom_type lookup.
Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2025-07-20 11:18:38 +02:00
Sarah Boyce
6aa05fd232 Triggered window resize to fix layout issues.
Some checks failed
Linters / flake8 (push) Has been cancelled
Linters / isort (push) Has been cancelled
Linters / black (push) Has been cancelled
Tests / Windows, SQLite, Python 3.13 (push) Has been cancelled
Tests / JavaScript tests (push) Has been cancelled
2025-07-18 17:29:12 +02:00
nessita
e767bd6838
Refs #35680 -- Sorted shell default autoimports to prevent isort mismatches. 2025-07-18 08:47:44 -03:00
IsJn-227
be8c9b19ba Fixed #36456 -- Improved content type negotiation in technical 500 error response.
Some checks are pending
Linters / flake8 (push) Waiting to run
Linters / isort (push) Waiting to run
Linters / black (push) Waiting to run
Tests / Windows, SQLite, Python 3.13 (push) Waiting to run
Tests / JavaScript tests (push) Waiting to run
2025-07-18 10:18:22 +02:00
Clifford Gama
449b9f9aee Fixed #35728 -- Computed error messages in assertions only on test failures.
Performance regression in 1dae65dc63.

Thanks to Adam Johnson for the report.
2025-07-18 10:16:59 +02:00
Clifford Gama
04e813cd17 Refs #4476 -- Added tests for assertRedirects() when following redirect chains.
Some checks are pending
Linters / flake8 (push) Waiting to run
Linters / isort (push) Waiting to run
Linters / black (push) Waiting to run
Tests / Windows, SQLite, Python 3.13 (push) Waiting to run
Tests / JavaScript tests (push) Waiting to run
Thanks Natalia Bidart for the review.
2025-07-17 17:36:02 -03:00
Clifford Gama
024ea0f783 Split monolithic AssertContainsTests.test_contains() into focused tests.
Added a local helper to test assertion messages with and without a given
msg_prefix.
2025-07-17 17:36:02 -03:00
Mike Edmunds
fc793fc303 Fixed #36163 -- Deprecated most positional arguments in django.core.mail.
In public mail APIs, changed less frequently used parameters from
keyword-or-positional to keyword-only, emitting a warning during the
required deprecation period.
2025-07-17 14:01:16 -03:00
Salvo Polizzi
a5cd84ad20 Fixed #35680 -- Added automatic imports of common utilies to shell management command. 2025-07-17 12:51:43 +02:00
Mike Edmunds
40d6eb2c01 Refs #35581 -- Added workaround for Python bug in mail tests.
Some checks are pending
Docs / docs (push) Waiting to run
Docs / blacken-docs (push) Waiting to run
Linters / flake8 (push) Waiting to run
Linters / isort (push) Waiting to run
Linters / black (push) Waiting to run
Tests / Windows, SQLite, Python 3.13 (push) Waiting to run
Tests / JavaScript tests (push) Waiting to run
See python/cpython#128110.
2025-07-16 15:33:14 +02:00
Mike Edmunds
5ca470a52e Refs #35581 -- Reduced implementation dependencies in mail tests.
Updated mail tests in preparation for migrating from Python's legacy
to modern email API. The updated tests will pass with either Python API,
and focus on desired outcomes (e.g., that a message with non-ASCII
content parses accurately at the receiving end) rather than specific
implementation details (e.g., where rfc2047 encoded-words are split).

In a few cases that are still implementation dependent, added comments
identifying behavior specific to the legacy email API and expected to
change under the modern one.

Added comments identifying tests that cover internal functions planned
for deprecation, and (where meaningful) added similar tests to verify
the equivalent behavior in non-deprecated features.

Removed obsolete tests left over from Python 2.
2025-07-16 15:33:14 +02:00
Mike Edmunds
f42b89f1bf
Fixed #36477, Refs #36163 -- Added @deprecate_posargs decorator to simplify deprecation of positional arguments.
This helper allows marking positional-or-keyword parameters as keyword-only with a deprecation period, in a consistent and correct manner.
2025-07-16 08:49:03 -03:00
Jacob Walls
43c68042c9
Skipped test_no_logs_without_debug test when the runner is invoked with --debug-sql. 2025-07-13 18:29:34 +02:00
Simon Charette
0fe218842e
Fixed #36502 -- Restored UNNEST strategy for foreign key bulk inserts on PostgreSQL.
Some checks failed
Docs / docs (push) Has been cancelled
Tests / Windows, SQLite, Python 3.13 (push) Has been cancelled
Tests / JavaScript tests (push) Has been cancelled
Linters / black (push) Has been cancelled
Docs / blacken-docs (push) Has been cancelled
Linters / flake8 (push) Has been cancelled
Linters / isort (push) Has been cancelled
Regression in 764af7a3d6.
2025-07-10 18:33:00 +02:00
Carlton Gibson
a8912e4383
Updated asgiref dependency. 2025-07-09 18:06:49 +02:00
Matthew Stell
7feafd79a4 Fixed #35846 -- Ensured consistent path ordering in ManifestStaticFilesStorage manifest files.
Some checks failed
Docs / docs (push) Waiting to run
Docs / blacken-docs (push) Waiting to run
Linters / flake8 (push) Has been cancelled
Linters / isort (push) Has been cancelled
Linters / black (push) Has been cancelled
Tests / Windows, SQLite, Python 3.13 (push) Has been cancelled
Tests / JavaScript tests (push) Has been cancelled
This change reuses the existing sorting of `hashed_files` in
`ManifestStaticFilesStorage.save_manifest` to also store a sorted
`paths` mapping in the manifest file. This ensures stable manifest
output that does not change unnecessarily.
2025-07-01 15:24:34 -03:00
Roel Delos Reyes
58fc40427f Fixed #36479 -- Improved how FileNotFoundError is triggered in code formatter tests.
Ensured the test for formatter subprocess FileNotFoundError doesn't rely
on platform-specific behavior, improving reliability on macOS and other
systems by consistently using pathlib to build test paths.
2025-07-01 15:24:07 -03:00
Simon Charette
192bc7a7be Fixed #36464 -- Fixed "__in" tuple lookup on backends lacking native support.
Some checks are pending
Docs / docs (push) Waiting to run
Docs / blacken-docs (push) Waiting to run
Linters / flake8 (push) Waiting to run
Linters / isort (push) Waiting to run
Linters / black (push) Waiting to run
Tests / Windows, SQLite, Python 3.13 (push) Waiting to run
Tests / JavaScript tests (push) Waiting to run
When native support for tuple lookups is missing in a DB backend, it can
be emulated with an EXISTS clause. This is controlled by the backend
feature flag "supports_tuple_lookups".

The mishandling of subquery right-hand side in `TupleIn` (added to
support `CompositePrimaryKey` in Refs #373) was likely missed because
the only core backend we test with the feature flag disabled
(Oracle < 23.4) supports it natively.

Thanks to Nandana Raol for the report, and to Sarah Boyce, Jacob Walls,
and Natalia Bidart for reviews.
2025-06-30 20:15:25 -03:00
Rob Hudson
d63241ebc7 Fixed #15727 -- Added Content Security Policy (CSP) support.
This initial work adds a pair of settings to configure specific CSP
directives for enforcing or reporting policy violations, a new
`django.middleware.csp.ContentSecurityPolicyMiddleware` to apply the
appropriate headers to responses, and a context processor to support CSP
nonces in templates for safely inlining assets.

Relevant documentation has been added for the 6.0 release notes,
security overview, a new how-to page, and a dedicated reference section.

Thanks to the multiple reviewers for their precise and valuable feedback.

Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2025-06-27 15:57:02 -03:00
antoliny0919
3f59711581 Fixed #36366 -- Improved accessibility of pagination in the admin.
Some checks are pending
Docs / docs (push) Waiting to run
Docs / blacken-docs (push) Waiting to run
Linters / flake8 (push) Waiting to run
Linters / isort (push) Waiting to run
Linters / black (push) Waiting to run
Tests / Windows, SQLite, Python 3.13 (push) Waiting to run
Tests / JavaScript tests (push) Waiting to run
2025-06-27 18:03:16 +02:00
wookkl
29f5e1e97d Fixed #35595, #35962 -- Removed indexes and constraints before fields in migrations. 2025-06-27 17:17:45 +02:00
Mike Edmunds
23529b6627 Fixed #36478 -- Fixed inconsistent mail attachment handling.
Some checks failed
Linters / black (push) Has been cancelled
Linters / flake8 (push) Has been cancelled
Linters / isort (push) Has been cancelled
Tests / Windows, SQLite, Python 3.13 (push) Has been cancelled
Tests / JavaScript tests (push) Has been cancelled
Fixed an inconsistency between EmailMessage.attach() and .attachments
when attaching bytes content with a text/* mimetype. The attach()
function decodes UTF-8 bytes if possible and otherwise changes the
mimetype to application/octet-stream to preserve the content's unknown
encoding (refs #27007). Providing equivalent content directly in
EmailMessage.attachments did not apply the same logic, leading
to an "AttributeError: 'bytes' object has no attribute 'encode'"
in SafeMIMEText.set_payload().

Updated EmailMessage._create_mime_attachment() to match attach()'s
handling for text/* mimetypes with bytes content. Updated test cases
to accurately cover behavior on both paths.
2025-06-26 08:54:01 +02:00