Commit Graph

12941 Commits

Author SHA1 Message Date
Simon Charette 1c4f5f314e Refs #32143 -- Removed superflous constraints on excluded query.
The outer query reference is not necessary when alias can be reused and
can even be harmful by confusing query planers.

Refs #34597.
2023-06-14 09:44:49 +02:00
David Smith 0cfcab4eec
Fixed date_time_picker_shortcuts() tests on Windows.
Windows does not allow overriding TIME_ZONE as time.tzset() is only
available on Unix.
2023-06-14 08:01:14 +02:00
Mariusz Felisiak 06881341d4
Refs #30220 -- Bumped required version of Selenium to 3.8.0.
Follow up to 8d010f3986.
2023-06-13 10:12:52 +02:00
sarahboyce decbfa834f Made SeleniumTests.test_select_multiple less flaky by adding explicit Selenium wait. 2023-06-13 08:26:34 +02:00
Nina Menezes 1699f8b52a Fixed #34628 -- Improved icons accessibility of related widget wrapper in admin.
This improves accessibility of icons by making them larger and grayscale
(when not selected).
2023-06-12 08:31:28 +02:00
Nick Pope e042024b28 Allowed custom formatting of lazy() objects.
This allows for formatting of lazy objects which have a custom formatter
defined by overriding the default implementation from `object`.
2023-06-12 06:09:20 +02:00
Nick Pope fd97b0471b Allowed multiplication of lazy() objects with int return type. 2023-06-12 05:59:40 +02:00
Ran Benita ae94077e7d Made proxy class in lazy() prepare eagerly.
Previously, the proxy class was prepared lazily:

  lazy_identity = lazy(identity, int)
  lazy_identity(10)  # prepared here
  lazy_identity(10)

This has a slight advantage that if the lazy doesn't end up getting
used, the preparation work is skipped, however that's not very likely.

Besides this laziness, it is also inconsistent in that the methods which
are wrapped directly (__str__ etc.) are prepared already when __proxy__
is defined, and there is a weird half-initialized state.

This change it so that everything is prepared already on the first line
of the example above.
2023-06-12 05:45:44 +02:00
Nick Pope e0e0204477 Added more tests for django.utils.functional.lazy(). 2023-06-12 05:29:30 +02:00
XDEv11 221c27bd6a
Added tests for HttpResponseBase.charset/reason_phrase setters. 2023-06-10 20:43:05 +02:00
Mariusz Felisiak caf80cb41f
Fixed #34645 -- Restored alignment for admin date/time timezone warnings.
Regression in 96a598356a.
2023-06-09 21:37:23 +02:00
Anders Kaseorg b81e974e9e Fixed #34604 -- Corrected fallback SQL for n-ary logical XOR.
An n-ary logical XOR Q(…) ^ Q(…) ^ … ^ Q(…) should evaluate to true
when an odd number of its operands evaluate to true, not when exactly
one operand evaluates to true.
2023-06-08 20:41:18 +02:00
Ran Benita a57d5d9bbc Made bytes and str return types no longer mutually exclusive in lazy().
They are no longer special cased.
2023-06-08 09:15:40 +02:00
Ran Benita f5817c24f4 Refs #34445 -- Fixed string-casting of non-string lazy objects when value may be bytes.
If the result type is bytes, then calling bytes() on it does nothing.

If the result type is not bytes, we should not cast to bytes, just
because the return value may be bytes.
2023-06-08 06:38:11 +02:00
benebsiny 7cc138a58f Added MultiPartParser tests for parsing base64-encoded fields. 2023-06-07 05:44:27 +02:00
devilsautumn 094b0bea2c Fixed #34609 -- Deprecated calling format_html() without arguments. 2023-06-06 14:14:57 +02:00
Mariusz Felisiak 4f6a51dfe6
Fixed lookup.tests.LookupTests.test_exclude() on PostgreSQL 16 beta 1.
Order doesn't matter for this test, and on PostgreSQL 16 "%" is ordered
before "_", so switch to sort by "pub_date".
2023-06-06 11:38:23 +02:00
Mariusz Felisiak 40a2c811e3
Refs #26706, Refs #34633 -- Added test for prefetch_related() cache invalidation in ManyRelatedManager.create(). 2023-06-06 07:33:59 +02:00
Coen van der Kamp 10d9d0ccb2 Fixed #34622 -- Improved accessibility of related widget wrapper in admin.
This improves accessibility for screen reader users by adding
"aria-disabled" and removing "alt".

Thanks Thibaud Colas for the report.
2023-06-05 14:43:51 +02:00
Howard Cox cd413bd78a Fixed #34621 -- Made admin site header render in <div> tag.
This was problematic for screen reader users because they use headings
to navigate. Having two <h1> is confusing, and the one in the header
wasn’t particularly helpful since it’s the same on all pages.
2023-06-05 11:55:06 +02:00
nessita 89c27d8672
Fixed #34601 -- Added field name to check message for ModelAdmin.readonly_fields.
Co-authored-by: Rick van Hattem <wolph@wol.ph>
2023-06-05 05:56:53 +02:00
Mariusz Felisiak f9936deed1
Fixed #34620 -- Fixed serialization crash on m2m fields without natural keys when base querysets use select_related().
Regression in 19e0587ee5.

Thanks Martin Svoboda for the report.
2023-06-04 20:49:07 +02:00
Nina Menezes 27fed08e5f
Fixed #34618 -- Added icon descriptions in "Recent Actions" on the admin index. 2023-06-02 12:32:18 +02:00
Simon Charette 2cf76f2d5d Fixed #34612 -- Fixed QuerySet.only() crash on reverse relationships.
Regression in b3db6c8dcb.

Thanks Ian Cubitt for the report.

This also corrected test_inheritance_deferred2() test which was
previously properly defined and marked as an expected failure but was
then wrongly adjusted to mask the lack of support for per-alias
deferral that was fixed by #21204.
2023-06-01 19:50:47 +01:00
Simon Charette d9e7018796 Refs #34570 -- Added extra tests for QuerySet.only() noops. 2023-06-01 19:49:26 +01:00
Cheuk Ting Ho 65da6b2ae4
Fixed #34617 -- Enabled user zooming on mobile devices in the admin. 2023-06-01 13:37:25 +01:00
Kacper Wolkiewicz 91be6e1818
Fixed #34606 -- Fixed Right() function with zero length on Oracle and SQLite. 2023-05-31 11:57:40 +01:00
Tom Forbes ea8cbca579 Made MigrationRecorder cache has_table() result if django_migrations table exists. 2023-05-25 13:18:02 +02:00
David Sanders 0c1518ee42
Fixed #34590 -- Reverted "Refs #33308 -- Improved adapting DecimalField values to decimal."
This reverts 7990d254b0.

Thanks Marc Odermatt for the report.
2023-05-24 10:59:55 +02:00
minusf 8b053c1e3c
Fixed #34592 -- Removed Safari/Chrome workaround for system fonts. 2023-05-24 10:26:25 +02:00
Mariusz Felisiak fc9c90d9c4
Refs #34118 -- Fixed FunctionalTests.test_cached_property_reuse_different_names() on Python 3.12+.
Python 3.12+ no longer wraps exceptions in __set_name__, see
55c99d97e1
2023-05-23 12:56:33 +02:00
Ben Lomax 23abec9192 Refs #31949 -- Made @no_append_slash decorator to work with async functions. 2023-05-23 10:04:41 +02:00
Simon Charette e5c844d6f2 Fixed #34551 -- Fixed QuerySet.aggregate() crash when referencing subqueries.
Regression in 59bea9efd2.

Refs #28477.

Thanks Denis Roldán and Mariusz for the test.
2023-05-23 06:25:58 +02:00
Simon Charette 2ee01747c3 Refs #34551 -- Fixed QuerySet.aggregate() crash on precending aggregation reference.
Regression in 1297c0d0d7.

Refs #31679.
2023-05-23 06:25:27 +02:00
Andrii Kohut f8172f45fc Fixed #34587 -- Allowed customizing table name normalization in inspectdb command. 2023-05-22 16:48:06 +02:00
Arthur Moreira 061a8a1bd8 Fixed #34577 -- Added escapeseq template filter. 2023-05-22 09:58:03 +02:00
Ben Lomax 00f5d2d110 Refs #31949 -- Made @xframe_options_(deny/sameorigin/exempt) decorators to work with async functions. 2023-05-20 15:52:00 +02:00
Ben Lomax b43936f2ec Moved clickjacking decorator tests into decorators/test_clickjacking.py.
This also adds extra assertions.
2023-05-20 15:23:52 +02:00
rajeeshp a2da81fe08 Fixed #34578 -- Made "join" template filter respect autoescape for joiner. 2023-05-19 13:16:42 +02:00
HappyDingning 674c23999c Fixed #34565 -- Added support for async checking of user passwords. 2023-05-18 09:39:04 +02:00
Carlton Gibson 4a5753fb0a
Refs #32339 -- Fixed super() call in deprecated renderers.
Missing function call `()` leads to:

TypeError: descriptor '__init__' of 'super' object needs an argument

Regression in b209518089.
2023-05-17 11:11:43 -03:00
Mariusz Felisiak c52f4295f2
Fixed #34568 -- Made makemigrations --update respect --name option.
Thanks David Sanders for the report.
2023-05-17 13:14:43 +02:00
Simon Charette 99e5dff737 Fixed #34570 -- Silenced noop deferral of many-to-many and GFK.
While deferring many-to-many and GFK has no effect, the previous
implementation of QuerySet.defer() ignore them instead of crashing.

Regression in b3db6c8dcb.

Thanks Paco Martínez for the report.
2023-05-17 08:06:11 +02:00
Julie Rymer 0ec60661e6 Fixed #34539 -- Restored get_prep_value() call when adapting JSONFields.
Regression in 5c23d9f0c3.
2023-05-16 08:26:41 +02:00
Ian Foote 7414704e88 Fixed #470 -- Added support for database defaults on fields.
Special thanks to Hannes Ljungberg for finding multiple implementation
gaps.

Thanks also to Simon Charette, Adam Johnson, and Mariusz Felisiak for
reviews.
2023-05-12 19:11:40 +02:00
Mariusz Felisiak 72a86ceb33
Fixed #34558 -- Fixed QuerySet.bulk_create() crash with Now() on Oracle. 2023-05-11 18:22:55 +02:00
Simon Charette ffff17d4b0 Fixed #34553 -- Fixed improper % escaping of literal in constraints.
Proper escaping of % in string literals used when defining constaints
was attempted (a8b3f96f6) by overriding quote_value of Postgres and
Oracle schema editor. The same approach was used when adding support for
constraints to the MySQL/MariaDB backend (1fc2c70).

Later on it was discovered that this approach was not appropriate and
that a preferable one was to pass params=None when executing the
constraint creation DDL to avoid any form of interpolation in the first
place (42e8cf47).

When the second patch was applied the corrective of the first were not
removed which caused % literals to be unnecessary doubled. This flew
under the radar because the existings test were crafted in a way that
consecutive %% didn't catch regressions.

This commit introduces an extra test for __exact lookups which
highlights more adequately % doubling problems but also adjust a
previous __endswith test to cover % doubling problems (%\% -> %%\%%).

Thanks Thomas Kolar for the report.

Refs #32369, #30408, #30593.
2023-05-10 17:25:57 +02:00
Simon Charette e0f8104a96 Refs #34553 -- Split constraint escaping test in subtests.
This ensures that constraint violations are tested in isolation from
each other as an IntegrityError only ensures a least one constraint is
violated.

For example, the assertion added in 42e8cf4 break both the
name_constraint_rhs and the rebate_constraint constraints and thus
doesn't constitute a proper regression test. Refs #32369.
2023-05-10 17:25:57 +02:00
Mariusz Felisiak 6e32d1fa1d
Fixed #34554 -- Fixed Reverse(Value(…)) crash on Oracle. 2023-05-10 17:22:45 +02:00
Akash Kumar Sen 92f0017133 Refs #34534 -- Reduced Add/RemoveConstraint and Add/RenameIndex operations when optimizing migrations. 2023-05-09 12:45:09 +02:00