Commit Graph

34256 Commits

Author SHA1 Message Date
Jacob Walls
b665a67d61 Fixed #36788 -- Fixed horizontal form field alignment under <fieldset> in the admin.
Thanks Antoliny for the review.

Regression in 4187da258f.
2026-02-02 08:15:13 -05:00
Jacob Walls
986f7f2098 Added missing quotes around nonce in docs/ref/csp.txt. 2026-02-02 07:29:41 -05:00
Jacob Walls
674eda1c03 Refs #36865 -- Fixed test_exact_lookup_validates_each_field_independently() crash on databases that don't support primitives in JSONFields.
For example on Oracle < 21c.
2026-01-31 11:48:59 -05:00
Tim Graham
bb8c14b466 Added supports_expression_indexes skip to nulls_distinct test. 2026-01-31 16:26:27 +01:00
Jacob Walls
4a52533329 Refs #34118 -- Removed asgiref coroutine detection shims.
As Python 3.12 is now the floor, we can drop the shims and
use the `inspect` module.
2026-01-31 08:59:54 -05:00
Tim Schilling
93dfb16e96 Added documentation on reviewing patches.
Original inspiration drawn from Sarah Boyce's talk:
"Django needs you! (to do code review)"
2026-01-30 20:48:59 -05:00
Jacob Walls
cbc4c9f11f Fixed typos in docs/ref/models/querysets.txt. 2026-01-30 15:59:14 -05:00
Mark Niehues
08a0b92329 Fixed #36468 -- Fixed failure to close popup when adding a related object in the admin.
The issue manifested when there were multiple relations and only some
of them participated in a filter_horizontal.

Regression in cd0479ff76.
2026-01-30 14:07:16 -05:00
mlissner
4cecf30395 Fixed #36865 -- Removed casting from exact lookups in admin searches.
Instead of casting non-text fields to CharField (which prevents index
usage), skip exact lookups when the search term fails
formfield.to_python().

This preserves index usage for valid searches while gracefully handling
invalid search terms by simply not including them in the query for that
field.

For multi-term searches like 'foo 123' on search_fields=['name', 'age__exact']:
- 'foo': invalid for age, so only name lookup is used
- '123': valid for both, so both lookups are used

This entails a slight increase in permissiveness for search terms that
can be normalized by formfield.to_python().
2026-01-30 11:45:39 -05:00
mlissner
b25bc24418 Refs #36865 -- Added test for invalid value handling in admin changelist. 2026-01-30 11:45:39 -05:00
Natalia
f87c2055b4 Fixed spell checking in docs GitHub Actions workflow.
The spelling check job was passing even with spelling errors because
the system spell checker (`aspell`) was not installed on the GitHub
Actions runner. While `sphinxcontrib.spelling` and `PyEnchant` were
installed via pip, they require a system-level spell checker backend
to function.
2026-01-29 11:20:11 -03:00
Natalia
117ff1d37d Made explicit that aspell is a requirement to run spell checks on docs. 2026-01-29 11:20:11 -03:00
Natalia
ba96379011 Fixed docs spelling errors accumulated over time.
The `docs` GitHub action does not install `aspell` so the seplling
checks are always passing in CI. After installing it, the following
errors are reported:

WARNING: internals/security.txt:50: : Spell check: runnable: Include a runnable proof of concept.
WARNING: ref/contrib/postgres/search.txt:292: : Spell check: lexeme: an untrusted source. The content of each lexeme is escaped so that any.
WARNING: ref/contrib/postgres/search.txt:295: : Spell check: lexemes: You can combine lexemes with other lexemes using the .
WARNING: ref/contrib/postgres/search.txt:295: : Spell check: lexemes: You can combine lexemes with other lexemes using the .
WARNING: ref/contrib/postgres/search.txt:314: : Spell check: Lexeme: Lexeme objects also support term weighting and prefixes:.
WARNING: ref/models/database-functions.txt:1897: : Spell check: ai: 23ai/26ai (23.9) or later..
WARNING: ref/models/database-functions.txt:1897: : Spell check: ai: 23ai/26ai (23.9) or later..
WARNING: ref/models/expressions.txt:439: : Spell check: positionally:  can be supplied positionally or only by keyword. For.
WARNING: ref/models/fields.txt:1339: : Spell check: ai: PostgreSQL < 18 only supports persisted columns. Oracle < 23ai/26ai (23.7).
WARNING: ref/models/fields.txt:1339: : Spell check: ai: PostgreSQL < 18 only supports persisted columns. Oracle < 23ai/26ai (23.7).
WARNING: ref/models/fields.txt:1344: : Spell check: ai: s was added on Oracle 23ai/26ai.
WARNING: ref/models/fields.txt:1344: : Spell check: ai: s was added on Oracle 23ai/26ai.
WARNING: releases/4.2.21.txt:24: : Spell check: unclosed: exception if it encounters an unusually large number of unclosed opening tags..
WARNING: releases/5.1.9.txt:24: : Spell check: unclosed: exception if it encounters an unusually large number of unclosed opening tags..
WARNING: releases/5.2.1.txt:24: : Spell check: unclosed: exception if it encounters an unusually large number of unclosed opening tags..
WARNING: releases/6.1.txt:244: : Spell check: mistyped: suggestions for mistyped subcommand names and argument choices..
WARNING: releases/6.1.txt:281: : Spell check: ai: Oracle 23ai/26ai (23.7+)..
WARNING: releases/6.1.txt:281: : Spell check: ai: Oracle 23ai/26ai (23.7+)..
WARNING: releases/6.1.txt:343: : Spell check: durations: durations expressed in weeks (.
WARNING: Found 19 misspelled words
build finished with problems, 20 warnings (with warnings treated as errors).

This branch adds some of the words to the allowlist, but for others I
chose to rephrase the text in a more approachable manner.
2026-01-29 11:20:11 -03:00
Nilesh Kumar Pahari
fe189dc43a Fixed #36847 -- Ensured auto_now_add fields are set on pre_save().
Regression in 94680437a4. Refs #27222.

During INSERT operations, `field.pre_save()` is called to prepare values
for db insertion. The `add` param must be `True` for `auto_now_add`
fields to be populated. The regression commit passed `False`, causing
`auto_now_add` fields to remain `None` when used by other fields, such
as `upload_to` callables.

Thanks Ran Benita for the report.
2026-01-29 10:11:33 -03:00
Samriddha9619
2831eaed79 Fixed #36233 -- Avoided quantizing integers stored in DecimalField on SQLite.
Co-authored-by: Simon Charette <charette.s@gmail.com>
Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
2026-01-28 17:04:39 -05:00
Jacob Walls
e61a54d306 Doc'd the minimum version of bash for releasing Django. 2026-01-28 16:51:29 -05:00
Markus Holtermann
83622b824b Fixed #36878 -- Unified data type for *_together options in ModelState.
Ever since the beginning of Django's migration framework, there's been a
bit of an inconsistency on how index_together and unique_together values
have been stored on the ModelState[^1].

It's only really obvious, when looking at the current code for
`from_model()`[^2] and the `rename_field()` state alteration code[^3].

The problem in the autodetector's detection of the `*_together` options
as raised in the ticket, reinforces the inconsistency[^4]: the old value
is being normalized to a set of tuples, whereas the new value is taken
as-is.

Why this hasn't been caught before, is likely to the fact, that we
never really look at a `to_state` that comes from migration operations
in the autodetector. Instead, in both usages in Django[^5], [^6] the
`to_state` is a `ProjectState.from_apps()`. And that state is
consistently using sets of tuples and not lists of lists.

[^1]: 67dcea711e (diff-5dd147e9e978e645313dd99eab3a7bab1f1cb0a53e256843adb68aeed71e61dcR85-R87)
[^2]: b1ffa9a9d7/django/db/migrations/state.py (L842)
[^3]: b1ffa9a9d7/django/db/migrations/state.py (L340-L345)
[^4]: b1ffa9a9d7/django/db/migrations/autodetector.py (L1757-L1771)
[^5]: 2351c1b12c/django/core/management/commands/makemigrations.py (L215-L219)
[^6]: 2351c1b12c/django/core/management/commands/migrate.py (L329-L332)
2026-01-28 16:13:05 -05:00
Tim Graham
5d5f95da40 Refs #35744 -- Removed problematic __in lookup in test_intersection_in_nested_subquery.
It's problematic on MongoDB. Simon: "It seems odd that we'd use
__in=OuterRef("pk") over __in=[OuterRef("pk")]. It's a SQLism that
only works because right-hand-side is wrapped with (...) and that's
interpreted as a singleton tuple which is allowed with IN."
2026-01-27 20:18:50 -05:00
Jacob Walls
b30e09a942 Added stub release notes and release date for 6.0.2, 5.2.11, and 4.2.28. 2026-01-27 15:31:24 -05:00
jafarkhan83
2e83eb5e78 Fixed #36776 -- Clarified dev server runs in WSGI mode. 2026-01-26 10:45:40 -05:00
varunkasyap
229d026207 Fixed #36883 -- Split monolithic aggregation regression tests. 2026-01-26 10:37:11 -05:00
Nilesh Kumar Pahari
e92d1e3b78 Fixed #36850 -- Prevented admin filter sidebar from wrapping below the changelist.
Removed flex-wrap from .changelist-form-container and added min-width to the
main content container to ensure proper layout behavior.
Regression in 6ea3319079.
2026-01-26 10:25:47 -05:00
Skyiesac
c3c9f1908e Fixed #36812 -- Dropped support for MariaDB < 10.11. 2026-01-25 09:19:43 +01:00
Jacob Walls
68d110f1fe Refs #33735 -- Coped with stacklevel change in ASGITest.test_file_response().
Follow-up to c042fe3a74.

The original ignore was added in 0bd2c0c901
but was not adjusted when the stacklevel changed.
2026-01-23 13:16:30 -05:00
Jacob Walls
2351c1b12c Refs #36620 -- Ran coverage tests workflow on forks.
We can continue to limit the coverage comment workflow to django/django,
but now that this workflow is the main python test workflow, it should
run on forks by default. The other tests workflow (currently running
only JavaScript tests) may start running python tests again once we flesh
out the matrix, but since it was duplicating the coverage tests configuration,
we temporarily removed it.

Follow-up to 26b0e2bb92.
2026-01-23 10:13:11 -05:00
seanhelvey
b1ffa9a9d7 Fixed #13883 -- Rendered named choice groups with <optgroup> in FilteredSelectMultiple.
This patch adds support for <optgroup>s in FilteredSelectMultiple widgets.
When a popup returns a new object, if the source field contains optgroup
choices, the optgroup is now also included in the response data.

Additionally, this adds error handling for invalid source_model parameters
to prevent crashes and display user-friendly error messages instead.

Co-authored-by: Michael McLarnon <mmclar@gmail.com>
2026-01-22 21:12:23 -05:00
Jacob Walls
3851601b2e Refs #36382 -- Fixed GDAL_VERSION comparison in gdal_tests.
Tests regression in 0d31ca9883.
2026-01-20 11:54:07 -05:00
VIZZARD-X
e083c62f51 Fixed #36030 -- Fixed precision loss in division of Decimal literals on SQLite.
Thanks Bob Kline for the review.
2026-01-20 10:42:28 -05:00
Skyiesac
e5cbb8b4be Fixed #36639 -- Added CI step to run makemigrations --check against test models. 2026-01-20 10:40:53 -05:00
Skyiesac
748c2ba837 Refs #36639 -- Updated test migrations to match models. 2026-01-20 10:40:53 -05:00
James Fysh
59fcd2a199 Fixed #36869 -- Optimized MigrationGraph._generate_plan membership checks.
Previously, `_generate_plan()` relied on list membership checks,
resulting in quadratic behavior as the plan grew. On large migration
graphs this became a significant performance bottleneck.

This change uses `OrderedSet` for the plan, reducing the complexity to
linear while preserving insertion order and behavior.

Co-authored-by: Nick Pope <nick@nickpope.me.uk>
2026-01-19 16:08:34 -03:00
Clifford Gama
d6cca8b904 Refs #25508 -- Updated outdated QuerySet.__repr__() results. 2026-01-19 09:58:43 -05:00
Clifford Gama
2541641347 Fixed unbalanced parentheses in docs. 2026-01-19 08:39:25 -05:00
Mariusz Felisiak
899eee3883 Ignored 6cff020787 formatting changes in git blame. 2026-01-19 10:00:34 +01:00
Mariusz Felisiak
6cff020787 Applied Black's 2026 stable style.
https://github.com/psf/black/releases/tag/26.1.0
2026-01-18 21:26:56 +01:00
David Smith
0d31ca9883 Refs #36382 -- Updated GDAL tests for Memory driver deprecation in GDAL 3.11.
Follow up to fb0d463b1f

Since GDAL 3.11 the Memory driver is deprecated with its functionality
merged into the MEM dataset driver.

https://gdal.org/en/stable/drivers/vector/memory.html
2026-01-16 12:38:21 -05:00
JaeHyuck Sa
0239e86f38 Fixed #36352 -- Improved error message for fields excluded by prior values()/values_list() calls.
Signed-off-by: JaeHyuck Sa <wogur981208@gmail.com>
2026-01-16 10:28:14 -05:00
Adam Johnson
a77e541d1d Fixed #36801 -- Avoided unnecessary calculation in construct_change_message().
`changed_field_labels` is only needed if there are changes to log, so move its
calculation, including the somewhat costly `translation_override()`, inside the
conditional that checks for changes. Also avoid reading `form.changed_data`
when it’s already bound to `changed_data`.

co-authored-by: Rodolfo Becerra <44782644+rodolvbg@users.noreply.github.com>
2026-01-16 09:17:57 -05:00
JaeHyuck Sa
211b631427 Fixed #36822 -- Added parameter limit for PostgreSQL with server-side binding. 2026-01-16 09:15:53 -05:00
JaeHyuck Sa
b98075dc62 Refs #36822 -- Hoisted bulk_batch_size() implementations to base backend. 2026-01-16 09:15:53 -05:00
Amar Ahmed Deina
07a1640745 Fixed #36856 -- Mentioned needsnewfeatureprocess resolution in contributor docs.
Co-authored-by: James Bligh <blighj@users.noreply.github.com>
2026-01-15 07:27:02 -05:00
Jacob Walls
a876ada18b Bumped linter versions in requirements files and tox.ini.
Follow-up to 64ac4385c7.
2026-01-14 15:07:10 -05:00
kundan223
924156072e Fixed #36855, Refs #27222 -- Mentioned multiple invocations of Field.pre_save() in 6.0 release notes.
Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
2026-01-14 14:45:03 -05:00
JaeHyuck Sa
4ce4ed72a4 Fixed #36821 -- Treated empty strings as NULL for iexact lookups on Oracle.
Signed-off-by: JaeHyuck Sa <wogur981208@gmail.com>
2026-01-14 13:31:15 -05:00
Jacob Walls
6a596373d4 Fixed #35402 -- Fixed crash in DatabaseFeatures.django_test_skips when running a subset of tests.
Thanks Tim Graham for the report and the review.
2026-01-14 08:25:37 -05:00
Samriddha9619
040bb3eba7 Fixed #35442 -- Prevented N+1 queries in RelatedManager with only().
Co-authored-by: Simon Charette <charette.s@gmail.com>
2026-01-13 13:18:14 -05:00
Jacob Walls
73c5e94521 Refs #36769 -- Raised SuspiciousOperation for unexpected nested tags in XML Deserializer.
Thanks Shai Berger and Natalia Bidart for reviews.
2026-01-12 16:38:32 -05:00
Jacob Walls
a25158f5cc Refs #36769 -- Avoided visiting grandchild nodes in XML Deserializer.
The only use case for visiting grandchild nodes turned out to be to
support an unintentionally invalid fixture in the test suite.

The invalid fixture added in #36969 was modeled on fixture9.xml in
dae08cf55b, so that is corrected as well
in this commit, where the test will still pass.
2026-01-12 16:38:32 -05:00
Jacob Walls
1a70889d58 Refs #36769 -- Corrected invalid XML fixtures.
fixture9.xml was likely wrong since its introduction in
35cc439228.

The relevant part of the Visa model is:

class Visa(models.Model):
    person = models.ForeignKey(Person, models.CASCADE)

The Visa.person <field>s needed to be declared as relations, and
the Person <field>s didn't need their values wrapped in `<natural>`,
since they weren't relations.
2026-01-12 16:38:32 -05:00
Adam Johnson
2b192bff26 Fixed #36858 -- Optimized Field._get_default() for db_default case.
Create and share a single instance of `DatabaseDefault` instead of making a new
one each time the lambda is called. The quick benchmark on the ticket shows a
~12% speedup for a large `bulk_create()` operation.
2026-01-12 14:05:04 -05:00