Commit Graph

32931 Commits

Author SHA1 Message Date
Mariusz Felisiak e3de574c1e Refs #35074 -- Simplified and unified adding spatial indexes on MySQL and Oracle.
This uses `deferred_sql` and `_field_indexes_sql()` instead of custom
hooks on MySQL.
2024-07-29 12:31:32 +02:00
Tim Graham b6ad8b687a Added missing skips in constraint tests. 2024-07-26 18:59:12 +02:00
nessita 1b277b45cc
Added dedicated test for invalid inputs in floatformat template filter tests.
Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
2024-07-25 16:15:53 -03:00
Lorenzo Peña 0e94f292cd 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 9e9792228a.
2024-07-25 09:38:46 +02:00
Sarah Boyce 2c024c9ac0 Added contributor guidelines for performance optimizations. 2024-07-25 09:25:25 +02:00
Devin Cox cd0479ff76 Fixed #35331 -- Updated dropdown lists with entries added via the '+' sign from M2M field. 2024-07-25 08:52:24 +02:00
Simon Charette f359990e49 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.
2024-07-25 07:48:53 +02:00
Sarah Boyce 8d6a20b656 Fixed #35604, Refs #35326 -- Made FileSystemStorage.exists() behaviour independent from allow_overwrite.
Partially reverts 0b33a3abc2.

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.
2024-07-24 14:55:10 +02:00
arjunomray 5559011c2b Fixed #35541 -- Fixed paginator border in admin CSS. 2024-07-24 12:28:23 +02:00
Mariusz Felisiak df35cf578f Updated asgiref dependency for 5.1 release series. 2024-07-24 08:21:07 +02:00
Mariusz Felisiak 6c89a53ab3 Bumped versions in pre-commit and npm configurations. 2024-07-24 08:09:29 +02:00
Mariusz Felisiak 9f5e2306e2
Refs #29049 -- Fixed isolation of BasicExpressionsTests._test_slicing_of_f_expressions() subtests.
Thanks Tim Graham for the report.
2024-07-23 14:29:14 -03:00
Flavio Curella f9bf616597
Fixed #35585 -- Corrected Query.exists() call in Query.has_results(). 2024-07-23 11:36:26 -03:00
Matthew Somerville fb7be022cb Updated example links in urlize docs.
goo.gl links are being removed in 2025:
https://developers.googleblog.com/en/google-url-shortener-links-will-no-longer-be-available/
2024-07-23 14:02:30 +02:00
nessita cf03aa4e94
Refs #10941 -- Reorganized querystring template tag docs. 2024-07-22 10:31:54 -03:00
Mariusz Felisiak b06cf62c88 Cleaned up temporary test directories in tests. 2024-07-22 08:51:01 +02:00
sobolevn 2ff917fd06 Applied optimizations to template.utils.get_app_template_dirs(). 2024-07-22 08:38:46 +02:00
Jacob Walls 1029a4694e Fixed typo in django/test/testcases.py docstring. 2024-07-22 08:36:13 +02:00
Bendeguz Csirmaz bdd538488c Fixed #35614 -- Prevented SQLCompiler.as_subquery_condition() from mutating a query. 2024-07-22 08:34:29 +02:00
Ellen b21f6d7ee4 Fixed broken link in django.core.files.temp docstring. 2024-07-22 08:29:21 +02:00
Muhammad N. Fadhil ee20e2d038 Fixed typos in Atomic docstring. 2024-07-22 08:27:27 +02:00
Simon Charette 9cb8baa0c4 Fixed #35559 -- Avoided unnecessary query on sliced union of empty queries.
While refs #34125 focused on the SQL correctness of slicing of union of
potentially empty queries it missed an optimization opportunity to avoid
performing a query at all when all queries are empty.

Thanks Lucidiot for the report.
2024-07-19 08:54:47 +02:00
Simon Charette 6b3f55446f Fixed #35603 -- Prevented F.__contains__() from hanging.
Regression in 94b6f101f7.
2024-07-18 08:39:10 +02:00
Hisham Mahmood 182f262b15 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 85366fbca7.
2024-07-18 08:09:37 +02:00
Simon Charette 0e49a8c3bd Refs #34701 -- Moved UniqueConstraint(nulls_distinct) validation tests.
The original tests required the creation of a model that is no longer necessary
and were exercising Model.full_clean(validate_constraints) which has nothing
to do with the nulls_distinct feature.
2024-07-17 12:52:17 +02:00
Simon Charette adc0b6aac3 Fixed #35594 -- Added unique nulls distinct validation for expressions.
Thanks Mark Gensler for the report.
2024-07-17 12:52:17 +02:00
Simon Charette 13922580cc 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>
2024-07-17 12:52:17 +02:00
nessita 5dc17177c3
Refs #10941 -- Renamed test file test_query_string.py to test_querystring.py.
This follows previous renames made in 27043bde5b.
2024-07-16 22:14:52 -03:00
Tim Graham 252eaca87f
Doc'd purpose of tuple() in SQLCompiler.get_from_clause().
It was added in 01d440fa1e to
prevent "RuntimeError: OrderedDict mutated during iteration".
That particular issue was fixed in d660cee5bc
but the issue could remain in Join.as_sql() subclasses.

Co-authored-by: Simon Charette <charette.s@gmail.com>
2024-07-16 15:00:30 -03:00
nessita 082fe2b5a8
Removed leftover KeyError handling after Query.tables attribute cleanup.
Follow up from f7f5edd50d.
2024-07-15 16:20:24 -03:00
Sarah Boyce 27043bde5b
Refs #10941 -- Renamed query_string template tag to querystring. 2024-07-15 13:28:55 -03:00
Maryam Yusuf 65344f0e1e Refs #35464 -- Added test to cover layout of TabularInline fieldsets. 2024-07-15 12:43:42 +02:00
Maryam Yusuf b5f4d76bc4 Fixed #35464 -- Updated docs to note fieldsets have limited impact on TabularInlines. 2024-07-15 12:43:42 +02:00
Sarah Boyce 86b548a59b Removed duplicate inline from tests.admin_inlines.admin.PhotographerAdmin. 2024-07-15 11:12:14 +02:00
Mariusz Felisiak 2d3bb414cf Refs #35560 -- Corrected required feature flags in GeneratedModelUniqueConstraint. 2024-07-15 10:20:09 +02:00
Tim Graham dfd63ff434
Refs #35506 -- Reverted "global URLconf" to "root URLconf" in tutorial 1. 2024-07-12 15:09:28 -03:00
Adam Johnson 86e13843c2 Refs #25466 -- Removed unused DeprecationInstanceCheck.
Unused since ff419de263.
2024-07-11 09:40:07 +02:00
Tim Graham b2fec1f08d Optimized Case.as_sql() default compilation.
Moving compiler.compile(self.default) to the else clause avoids
the call when it's unneeded in the FullResultSet case.
2024-07-11 08:19:04 +02:00
Tom Carrick 7264d7f750 Fixed syntax of CSS file used in tests. 2024-07-11 08:03:21 +02:00
Mike Edmunds b9098538a9 Fixed #35033, Refs #28912 -- Fixed repeated headers in EmailMessage.
Fixed a regression which would cause multiple To, Cc, and
Reply-To headers in the result of EmailMessage.message() if
values were supplied for both to/cc/reply_to and the
corresponding extra_headers fields.

Updated related tests to check the generated message() has
exactly one of each expected header using get_all().

Regression in b03d500295.
2024-07-11 08:00:46 +02:00
Sarah Boyce c6d1f98d26 Improved test coverage of urlize. 2024-07-10 09:32:02 +02:00
Daniel Patrick d12184fedc Fixed #35424 -- Checked order_with_respect_to is available when migrating _order fields.
Migrations would crash following the removal of an order_with_respect_to
field from a model and the addition of an _order field.
2024-07-10 08:40:50 +02:00
Natalia e095c7612d Added CVE-2024-38875, CVE-2024-39329, CVE-2024-39330, and CVE-2024-39614 to security archive. 2024-07-09 11:58:27 -03:00
Natalia 9c356144d7 Added stub release notes for 5.0.8. 2024-07-09 11:41:28 -03:00
Natalia 1062bf7302 Made cosmetic edits to 5.0.7 release notes. 2024-07-09 09:36:54 -03:00
Sarah Boyce 9e9792228a 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:21:19 -03:00
Natalia fe4a0bbe20 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:21:19 -03:00
Michael Manfre 5d86458579 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:21:19 -03:00
Adam Johnson d666457453 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:21:19 -03:00
jason_bruce af84bcc8d1 Fixed #35580 -- Allowed related fields referencing auto-created through models. 2024-07-09 13:50:12 +02:00