1
0
mirror of https://github.com/django/django.git synced 2025-03-13 10:50:55 +00:00

13453 Commits

Author SHA1 Message Date
Mariusz Felisiak
d9aeb23edb [5.1.x] Fixed #35661 -- Fixed test_too_many_digits_to_rander() test crash on PyPy.
Thanks Michał Górny for the report.

Backport of 7fb15ad5bcae05324ee8913e4b2c6c982e8f2de0 from main.
2024-08-08 09:55:21 +02:00
Natalia
d5ad743e79 [5.1.x] Fixed i18n.tests.TranslationTests.test_plural to use correct French translation. 2024-08-07 09:56:31 -03:00
Simon Charette
e2583fbc2e [5.1.x] Fixed CVE-2024-42005 -- Mitigated QuerySet.values() SQL injection attacks against JSON fields.
Thanks Eyal (eyalgabay) for the report.
2024-08-06 08:51:22 +02:00
Mariusz Felisiak
bd807c0c25 [5.1.x] Fixed CVE-2024-41991 -- Prevented potential ReDoS in django.utils.html.urlize() and AdminURLFieldWidget.
Thanks Seokchan Yoon for the report.

Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
2024-08-06 08:51:22 +02:00
Sarah Boyce
0c1a890916 [5.1.x] Fixed CVE-2024-41990 -- Mitigated potential DoS in urlize and urlizetrunc template filters.
Thanks to MProgrammer for the report.
2024-08-06 08:51:22 +02:00
Sarah Boyce
0504af6429 [5.1.x] Fixed CVE-2024-41989 -- Prevented excessive memory consumption in floatformat.
Thanks Elias Myllymäki for the report.

Co-authored-by: Shai Berger <shai@platonix.com>
2024-08-06 08:51:22 +02:00
Sarah Boyce
2ba4f4b0b5 [5.1.x] Fixed #35657 -- Made FileField handle db_default values.
Backport of 8deb6bb1fc427762d56646bf7306cbd11fb5bb68 from main.
2024-08-05 16:37:26 -03:00
David Sanders
aed4ffe189 [5.1.x] Fixed #35638 -- Updated validate_constraints to consider db_default.
Backport of 509763c79952cde02d9f5b584af4278bdbed77b2 from main.
2024-08-05 17:36:15 +02:00
John Parton
88ebcb1856 [5.1.x] Fixed #35628 -- Allowed compatible GeneratedFields for ModelAdmin.date_hierarchy.
Backport of 7f8d839722b72aeb3ec5a4278ae57c18283acacd from main.
2024-08-05 15:28:40 +02:00
Simon Charette
55f5292701 [5.1.x] Fixed #35643 -- Fixed a crash when ordering a QuerySet by a reference containing "__".
Regression in b0ad41198b3e333f57351e3fce5a1fb47f23f376.

Refs #34013. The initial logic did not consider that annotation aliases
can include lookup or transform separators.

Thanks Gert Van Gool for the report and Mariusz Felisiak for the review.
Backport of a16f13a8661297eda12c4177bb01fa2e5b5ccc56 from main.
2024-08-02 16:22:05 -03:00
Tim Graham
e9d4b03680 [5.1.x] Added missing skips in constraint tests.
Backport of b6ad8b687adf011245270df17a38c1a42792e3d7 from main.
2024-07-26 17:02:04 +02:00
nessita
694c45118a [5.1.x] Added dedicated test for invalid inputs in floatformat template filter tests.
Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>

Backport of 1b277b45cc4059760072095f3bd6e8a4e4c4d406 from main.
2024-07-25 16:17:56 -03:00
Lorenzo Peña
741f33eaf1 [5.1.x] Fixed #35627 -- Raised a LookupError rather than an unhandled ValueError in get_supported_language_variant().
LocaleMiddleware didn't handle the ValueError raised by
get_supported_language_variant() when language codes were
over 500 characters.

Regression in 9e9792228a6bb5d6402a5d645bc3be4cf364aefb.

Backport of 0e94f292cda632153f2b3d9a9037eb0141ae9c2e from main.
2024-07-25 09:40:49 +02:00
Simon Charette
d8116bf7f5 [5.1.x] Fixed #35625 -- Fixed a crash when adding a field with db_default and check constraint.
This is the exact same issue as refs #30408 but for creating a model with a
constraint containing % escapes instead of column addition. All of these issues
stem from a lack of SQL and parameters separation from the BaseConstraint DDL
generating methods preventing them from being mixed with other parts of the
schema alteration logic that do make use of parametrization on some backends
(e.g. Postgres, MySQL for DEFAULT).

Prior to the addition of Field.db_default and GeneratedField in 5.0
parametrization of DDL was never exercised on model creation so this is
effectively a bug with db_default as the GeneratedField case was addressed by
refs #35336.

Thanks Julien Chaumont for the report and Mariusz Felisiak for the review.

Backport of f359990e4909db8722820849d61a6f5724338723 from main.
2024-07-25 07:51:45 +02:00
Sarah Boyce
e42defb63b [5.1.x] Fixed #35604, Refs #35326 -- Made FileSystemStorage.exists() behaviour independent from allow_overwrite.
Partially reverts 0b33a3abc2ca7d68a24f6d0772bc2b9fa603744e.

Storage.exists(name) was documented to "return False if
the name is available for a new file." but return True if
the file exists. This is ambiguous in the overwrite file
case. It will now always return whether the file exists.

Thank you to Natalia Bidart and Josh Schneier for the
review.

Backport of 8d6a20b656ff3fa18e36954668a44a831c2f6ddd from main.
2024-07-24 14:58:57 +02:00
Mariusz Felisiak
e5d2664908 [5.1.x] Updated asgiref dependency for 5.1 release series.
Backport of df35cf578f99522dd1ba864d513be95d47bab7a5 from main.
2024-07-24 08:25:45 +02:00
Simon Charette
8fb7d30456 [5.1.x] Fixed #35603 -- Prevented F.__contains__() from hanging.
Regression in 94b6f101f7dc363a8e71593570b17527dbb9f77f.

Backport of 6b3f55446fdc62bd277903fd188a1781e4d92d29 from main.
2024-07-18 08:41:55 +02:00
Hisham Mahmood
5eef80b56e [5.1.x] Fixed #35606, Refs #34045 -- Fixed rendering of ModelAdmin.action_checkbox for models with a __html__ method.
Thank you Claude Paroz for the report.

Regression in 85366fbca723c9b37d0ac9db1d44e3f1cb188db2.

Backport of 182f262b15882649bbc39d769f9b721cf3660f6f from main.
2024-07-18 08:12:36 +02:00
Simon Charette
4d8e574379 [5.1.x] Fixed #35594 -- Added unique nulls distinct validation for expressions.
Thanks Mark Gensler for the report.

Backport of adc0b6aac3f8a5c96e1ca282bc9f46e28d20281c from main.
2024-07-17 12:56:01 +02:00
Simon Charette
a2791f5ea2 [5.1.x] Refs #30581 -- Made unattached UniqueConstraint(fields) validation testable.
The logic allowing UniqueConstraint(fields).validate to preserve backward
compatiblity with Model.unique_error_message failed to account for cases where
the constraint might not be attached to a model which is a common pattern
during testing.

This changes allows for arbitrary UniqueConstraint(fields) to be tested in
isolation without requiring actual models backing them up.

Co-authored-by: Mark G <mark.gensler@protonmail.com>

Backport of 13922580cccfb9ab2922ff4943dd39da56dfbd8c from main.
2024-07-17 12:55:36 +02:00
nessita
df7ebb8b02 [5.1.x] Refs #10941 -- Renamed test file test_query_string.py to test_querystring.py.
This follows previous renames made in 27043bde5b795eb4a605aeca1d3bc4345d2ca478.

Backport of 5dc17177c38662d6f4408258ee117cd80e0cb933 from main.
2024-07-16 22:17:13 -03:00
Sarah Boyce
91a5b5a4bb [5.1.x] Refs #10941 -- Renamed query_string template tag to querystring.
Backport of 27043bde5b795eb4a605aeca1d3bc4345d2ca478 from main.
2024-07-15 13:29:54 -03:00
Mariusz Felisiak
ebcbf73153 [5.1.x] Refs #35560 -- Corrected required feature flags in GeneratedModelUniqueConstraint.
Backport of 2d3bb414cfb2778cc64f22e7203102d7389f81e6 from main.
2024-07-15 10:22:52 +02:00
Sarah Boyce
e99ccc4342 [5.1.x] Fixed CVE-2024-39614 -- Mitigated potential DoS in get_supported_language_variant().
Language codes are now parsed with a maximum length limit of 500 chars.

Thanks to MProgrammer for the report.
2024-07-09 09:42:58 -03:00
Natalia
6d36203648 [5.1.x] Fixed CVE-2024-39330 -- Added extra file name validation in Storage's save method.
Thanks to Josh Schneier for the report, and to Carlton Gibson and Sarah
Boyce for the reviews.
2024-07-09 09:42:45 -03:00
Michael Manfre
f5d16483f3 [5.1.x] Fixed CVE-2024-39329 -- Standarized timing of verify_password() when checking unusuable passwords.
Refs #20760.

Thanks Michael Manfre for the fix and to Adam Johnson for the review.
2024-07-09 09:42:29 -03:00
Adam Johnson
44aef996c8 [5.1.x] Fixed CVE-2024-38875 -- Mitigated potential DoS in urlize and urlizetrunc template filters.
Thank you to Elias Myllymäki for the report.

Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
2024-07-09 09:42:12 -03:00
Mark Gensler
2da007737c [5.1.x] Fixed #35560 -- Made Model.full_clean() ignore GeneratedFields for constraints.
Accessing generated field values on unsaved models caused a crash when
validating CheckConstraints and UniqueConstraints with expressions.

Backport of 1005c2abd1ef0c156f449641e38c33e473989d37 from main.
2024-07-04 11:47:20 +02:00
nessita
432b069b5f [5.1.x] Fixed #35561 -- Made *args and **kwargs parsing more strict in Model.save()/asave().
Backport of e56a32b89bb7fadffdfaa2cdf12b4863ccd5af9b from main.
2024-06-26 12:14:31 -03:00
Sarah Boyce
c99ce49d2e [5.1.x] Fixed #35558 -- Increased inline H3 headers color prominence in admin change page.
Backport of e510bb1ab1fb22837c169e0459b81cf388b6d8d2 from main.
2024-06-25 14:04:07 -03:00
Adam Johnson
387172918f [5.1.x] Fixed #35554, Refs #35060 -- Corrected deprecated *args parsing in Model.save()/asave().
The transitional logic added to deprecate the usage of *args for
Model.save()/asave() introduced two issues that this branch fixes:
 * Passing extra positional arguments no longer raised TypeError.
 * Passing a positional but empty update_fields would save all fields.

Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>

Backport of 28522c3c8d5eb581347aececc3ac61c134528114 from main.
2024-06-25 13:14:19 -03:00
Carlton Gibson
38248588f6 [5.1.x] Refs #35059 -- Used asyncio.Event in ASGITest.test_asyncio_cancel_error to enforce specific interleaving.
Sleep call leads to a hard to trace error in CI. Using an Event is
more deterministic, and should be less prone to environment
variations.

Bug in 11393ab1316f973c5fbb534305750740d909b4e4.

Backport of f4a08b6ddfcacadfe9ff8364bf1c6c54f5dd370f from main.
2024-06-25 11:05:37 -03:00
Sarah Boyce
63178036b3 [5.1.x] Fixed #35545, Refs #32833 -- Fixed ContentTypeManager.get_for_models() crash in CreateModel migrations.
Thank you to Csirmaz Bendegúz for the report and Simon Charettes for the review.

Backport of f1705c8780c0a7587654fc736542d55fe4a7f29b from main.
2024-06-24 10:21:54 +02:00
Mariusz Felisiak
4e04c99d18 [5.1.x] Simplified OperationTestCase.alter_gis_model() test hook a bit.
This avoids passing "blank=False" and "srid=4326" to field classes,
which are the default values, and removes special treatment for the
"blank" parameter.

Backport of a0c44d4e23f8f509757f97f28fbbb1ced3382361 from main.
2024-06-20 11:53:25 +02:00
Mariusz Felisiak
adb72fa854 [5.1.x] Refs #35074 -- Avoided failed attempts to remove spatial indexes on nullable fields on MySQL.
MySQL doesn't support spatial indexes on NULL columns, so there is no
point in removing them.

Backport of 20c2d625d3d5062e43918d1d7b6f623202491dd4 from main.
2024-06-20 11:46:33 +02:00
Alexander Lötvall
b8983dcf57 [5.1.x] Fixed #35483 -- Added NUL (0x00) character validation to ModelChoiceFields.
Applied the ProhibitNullCharactersValidator to ModelChoiceField and ModelMultipleChoiceField.

Co-authored-by: Viktor Paripás <viktor.paripas@gmail.com>
Co-authored-by: Vasyl Dizhak <vasyl@dizhak.com>
Co-authored-by: Arthur Vasconcelos <vasconcelos.arthur@gmail.com>

Backport of 38ad710aba885ad26944ff5708ce1a02a446d2d3 from main.
2024-06-17 12:22:32 +02:00
Mariusz Felisiak
a0f6835f72 [5.1.x] Refs #34881 -- Fixed OperationTests.test_rename_m2m_field_with_2_references() test on Oracle.
Backport of fa7848146738a9fe1d415ee4808664e54739eeb7 from main.
2024-06-14 19:55:09 +02:00
Mariusz Felisiak
06f0141691 [5.1.x] Fixed mail.tests.MailTests.test_backend_arg() test on Python 3.13+.
There is no point in asserting Python error messages.

Backport of 4ee68bb4f50dbe842461f8f340bb1633fddd4a53 from main.
2024-06-14 14:27:40 +02:00
Anže Pečar
48382a2ff6 [5.1.x] Fixed #34881 -- Fixed a crash when renaming a model with multiple ManyToManyField.through references on SQLite.
Thank you to dennisvang for the report and Jase Hackman for the test.

Co-authored-by: Jase Hackman <jase.hackman@zapier.com>

Backport of e99187e5c94516ee35f37cc41a36d906b395808d from main.
2024-06-14 14:16:34 +02:00
Madalin Popa
dbd1a8bd41 [5.1.x] Fixed #35488 -- Fixed BaseModelFormSet.validate_unique() crash due to unhashable type.
Backport of d28626ecf8bd340084ed70ff2d88e8dbab001e2c from main.
2024-06-14 14:10:19 +02:00
George Y. Kussumoto
64443f555f [5.1.x] Fixed #35417 -- Updated BaseContext.new() with values to create a context that can be flattened.
Backport of 2a32b233822683c51e59722b7c9aa0789fc4ab1b from main.
2024-06-14 14:07:51 +02:00
Devin Cox
49a3a8d9a2 [5.1.x] Fixed #34789 -- Prevented updateRelatedSelectsOptions from
adding entries to filter_horizontal chosen box.

Co-authored-by: yokeshwaran1 <yokesh440@yahoo.com>

Backport of 719a42b589d7551fc84708044b9e984ce723c8a2 from main.
2024-06-14 14:05:11 +02:00
Jacob Walls
db349fc464 [5.1.x] Fixed #35469 -- Removed deferred SQL to create index removed by AlterField operation.
Backport of 99f23eaabd8da653f046dc1d19f5008c030a4f79 from main.
2024-06-14 13:56:43 +02:00
Simon Törnqvist
e65b7d5b06 [5.1.x] Fixed #35443 -- Changed ordinal to return negative numbers unchanged.
Previously, `-1` was converted to `"-1th"`. This has been updated to
return negative numbers "as is", so that for example `-1` is
converted to `"-1"`. This is now explicit in the docs.

Co-authored-by: Martin Jonson <artin.onson@gmail.com>

Backport of d3a7ed5bcc45000a6c3dd55d85a4caaa83299f83 from main.
2024-06-14 13:53:43 +02:00
Fabian Braun
9996bb1ead [5.1.x] Fixed #35477 -- Corrected 'required' errors in auth password set/change forms.
The auth forms using SetPasswordMixin were incorrectly including the
'This field is required.' error when additional validations (e.g.,
overriding `clean_password1`) were performed and failed.
This fix ensures accurate error reporting for password fields.

Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>

Backport of 339977d4441fd353e20950b98bad3d42afb1f126 from main.
2024-05-30 16:31:52 -03:00
Sarah Boyce
501e32a7f5 [5.1.x] Fixed #35472 -- Used temporary directory in test_imagefield.NoReadTests.
Backport of 7e39ae5c8cf4c6601a4f47b72914349481c5331b from main.
2024-05-22 16:38:28 -03:00
Willem Van Onsem
2995aeab56 Fixed #35393 -- Added excluded pk as a hidden field to the inline admin. 2024-05-22 10:31:24 +02:00
Hisham Mahmood
c7fc9f20b4 Fixed #31405 -- Added LoginRequiredMiddleware.
Co-authored-by: Adam Johnson <me@adamj.eu>
Co-authored-by: Mehmet İnce <mehmet@mehmetince.net>
Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
2024-05-22 08:51:17 +02:00
Marijke Luttekes
e4a693f50a Fixed #35189 -- Improved admin collapsible fieldsets by using <details> elements.
This work improves the accessibility of the add and change pages in the
admin site by adding <details> and <summary> elements to the collapsible
fieldsets. This has the nice side effect of no longer requiring custom
JavaScript helpers to implement the fieldsets' show/hide capabilities.

Thanks to James Scholes for the accessibility advice, and to Sarah Boyce
and Tom Carrick for reviews.

Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
2024-05-22 00:13:55 -03:00
Marijke Luttekes
01ed59f753 Refs #35189 -- Improved admin fieldset's accessibility by setting aria-labelledby.
Before this change, HTML <fieldset> elements in the admin site did not
have an associated label to describe them. This commit defines a unique
HTML id for the heading labeling a fieldset, and sets its
aria-labelledby property to link the heading with the fieldset.
2024-05-22 00:13:55 -03:00