1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00
Commit Graph

31864 Commits

Author SHA1 Message Date
sarahboyce
531f557f92 Fixed #23049 -- Added %a and %A support to Date.strftime.
This enables the admin to display the day as locale's abbreviated/full
name if %a/%A is used in the date format.
2023-06-09 12:18:17 +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
ee36e101e8 Optimized lazy() by removing use of @total_ordering.
@total_ordering is slow. Using the following micro-benchmark
(resultclasses intentionally omitted to narrow the scope):

    import cProfile
    from django.utils.functional import lazy
    def identity(x): return x
    cProfile.run("for i in range(10000): str(lazy(identity)(1))")

Before:

    380003 function calls in 0.304 seconds

    ncalls  tottime  percall  cumtime  percall filename:lineno(function)
         1    0.016    0.016    0.304    0.304 <string>:1(<module>)
     10000    0.002    0.000    0.002    0.000 bench.py:5(double)
     10000    0.005    0.000    0.006    0.000 functional.py:100(__cast)
     10000    0.007    0.000    0.013    0.000 functional.py:106(__str__)
     10000    0.005    0.000    0.017    0.000 functional.py:140(__wrapper__)
     10000    0.020    0.000    0.258    0.000 functional.py:60(lazy)
     10000    0.039    0.000    0.039    0.000 functional.py:68(__proxy__)
     10000    0.010    0.000    0.012    0.000 functional.py:77(__init__)
     10000    0.002    0.000    0.002    0.000 functional.py:84(__prepare_class__)
     10000    0.025    0.000    0.075    0.000 functools.py:186(total_ordering)
     10000    0.015    0.000    0.028    0.000 functools.py:189(<setcomp>)
     10000    0.024    0.000    0.044    0.000 functools.py:37(update_wrapper)
     10000    0.005    0.000    0.005    0.000 functools.py:67(wraps)
     10000    0.074    0.000    0.114    0.000 {built-in method builtins.__build_class__}
         1    0.000    0.000    0.304    0.304 {built-in method builtins.exec}
    150000    0.023    0.000    0.023    0.000 {built-in method builtins.getattr}
     10000    0.004    0.000    0.004    0.000 {built-in method builtins.max}
     80000    0.025    0.000    0.025    0.000 {built-in method builtins.setattr}
         1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
     10000    0.003    0.000    0.003    0.000 {method 'update' of 'dict' objects}

After:

    240003 function calls in 0.231 seconds

    ncalls  tottime  percall  cumtime  percall filename:lineno(function)
         1    0.016    0.016    0.231    0.231 <string>:1(<module>)
     10000    0.002    0.000    0.002    0.000 bench.py:5(double)
     10000    0.006    0.000    0.012    0.000 functional.py:105(__str__)
     10000    0.005    0.000    0.017    0.000 functional.py:159(__wrapper__)
     10000    0.015    0.000    0.186    0.000 functional.py:60(lazy)
     10000    0.022    0.000    0.022    0.000 functional.py:68(__proxy__)
     10000    0.010    0.000    0.012    0.000 functional.py:76(__init__)
     10000    0.002    0.000    0.002    0.000 functional.py:83(__prepare_class__)
     10000    0.004    0.000    0.006    0.000 functional.py:99(__cast)
     10000    0.023    0.000    0.043    0.000 functools.py:37(update_wrapper)
     10000    0.004    0.000    0.004    0.000 functools.py:67(wraps)
     10000    0.102    0.000    0.124    0.000 {built-in method builtins.__build_class__}
         1    0.000    0.000    0.231    0.231 {built-in method builtins.exec}
     70000    0.011    0.000    0.011    0.000 {built-in method builtins.getattr}
     50000    0.007    0.000    0.007    0.000 {built-in method builtins.setattr}
         1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
     10000    0.003    0.000    0.003    0.000 {method 'update' of 'dict' objects}
2023-06-08 09:17:50 +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
459f30f73e Removed unnecessary wrapping of __bytes__ in proxy class in lazy(). 2023-06-08 09:15:40 +02:00
Ran Benita
c7ba2e3cbb Removed unnecessary branch in __mod__() from proxy class in lazy().
Unnecessary since c716fe8782 and
7b2f2e74ad.
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
Akash Kumar Sen
5f2308710b Fixed #30355 -- Doc'd interaction between custom managers and prefetch_related(). 2023-06-07 11:48:01 +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
Nina Menezes
51fdea6841
Fixed #34627 -- Highlighted active row in admin UI when forced-colors mode is enabled. 2023-06-05 16:37:17 -03:00
nessita
e26d1a91d7
Added stub release notes for 4.2.3. 2023-06-05 14:55:23 -03: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
Natalia
0faad01938 Added release date for 4.2.2. 2023-06-05 08:21:56 -03: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
Mariusz Felisiak
1136aa5005
Refs #23528 -- Made cosmetic edits to swappable_dependency() docs. 2023-06-03 12:01:15 +02:00
DevilsAutumn
7d96ce68ae Fixed #23528 -- Doc'd django.db.migrations.swappable_dependency(). 2023-06-02 20:57:41 +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
Michael Howitz
4142739af1
Added local copy of Django to deps in tox.ini.
This also bumps tox to 4.0.
2023-06-01 14:56:41 +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
AP Jama
4037223d0f Fixed #34595 -- Doc'd that format_string arg of format_html() is not escaped. 2023-06-01 12:10:08 +01:00
Christopher Cave-Ayland
24d56e21c3
Fixed #34616 -- Corrected label examples in 5.0 release notes. 2023-06-01 11:19:11 +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
Akash Kumar Sen
b0a6cc7f57 Fixed #34600 -- Removed references to bleach in docs. 2023-05-31 09:52:38 +01:00
Mariusz Felisiak
d3d173425f
Optimized @condition decorator a bit.
This removes unnecessary get_last_modified() hook.
2023-05-26 12:16:26 +02:00
Natalia
881cc139e2 Refs #34574, Refs #34577 -- Mentioned escapeseq filter in escape/autoescape docs. 2023-05-26 06:26:38 +02:00
Natalia
1a59a324ce Fixed #34574 -- Noted unexpected outcomes in autoescape/escape docs. 2023-05-26 06:21:46 +02: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
9d756afb07
Refs #34593 -- Commented that the extra count is necessary in ChangeList.get_results(). 2023-05-24 12:00:50 -03: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
Stefan Brand
eb9df03a43
Corrected documentation of Log database function. 2023-05-24 05:29:50 +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
Mohit Singh Sinsniwal
89f10a80d7 Fixed #34579 -- Added Django Forum to contributing guides.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2023-05-22 20:21:18 +02:00
Andrii Kohut
f8172f45fc Fixed #34587 -- Allowed customizing table name normalization in inspectdb command. 2023-05-22 16:48:06 +02:00
Sarah Boyce
c3862735cd
Fixed references to django.core.cache in docs. 2023-05-22 14:02:01 +02:00
gtleee
0a324f1b66 Fixed #34588 -- Removed usage of nonexistent stylesheet in the 'Congrats' page.
Regression in d46cc15c51.
2023-05-22 11:05:20 +02:00
Arthur Moreira
061a8a1bd8 Fixed #34577 -- Added escapeseq template filter. 2023-05-22 09:58:03 +02:00
Simon Charette
98f6ada0e2 Fixed #34580 -- Avoided unnecessary computation of selected expressions in SQLCompiler.
Performance regression in 278881e376.

Co-authored-by: David Smith <smithdc@gmail.com>
2023-05-22 05:47:29 +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