1
0
mirror of https://github.com/django/django.git synced 2024-12-27 19:46:22 +00:00
Commit Graph

13113 Commits

Author SHA1 Message Date
Simon Charette
73869a5163 [5.0.x] Refs #30446, Refs #34944 -- Fixed crash when adding GeneratedField with string Value().
This should allow smarter output_field inferring in functions dealing
with text expressions.

Regression in f333e3513e.

Backport of 8b1acc0440 from main
2023-11-08 16:18:00 +03:00
Simon Charette
0265eaa500 [5.0.x] Fixed #34946 -- Preserved db_default on combined default field addition.
Regression in 7414704e88.
Backport of 8a28e983df from main
2023-11-07 13:33:24 +03:00
David Sanders
8dde0504f3 [5.0.x] Fixed #34936 -- Fixed migration crash for DecimalField with db_default on SQLite.
CAST() must be wrapped in parentheses to be recognized as an expression on SQLite.

Regression in 7414704e88.

Backport of 797957fb48 from main
2023-11-02 19:59:39 +01:00
Tim Graham
b735b90f43 [5.0.x] Refs #31300 -- Allowed testing GeneratedField without collation.
CockroachDB and Snowflake don't support it.

Backport of 208870b612 from main
2023-11-02 15:48:31 +01:00
Mariusz Felisiak
bb71d34551 [5.0.x] Fixed CVE-2023-46695 -- Fixed potential DoS in UsernameField on Windows.
Thanks MProgrammer (https://hackerone.com/mprogrammer) for the report.
2023-11-01 06:18:00 +01:00
Tom Carrick
602835202d [5.0.x] Fixed #34932 -- Restored varchar_pattern_ops/text_pattern_ops index creation when deterministic collaction is set.
Regression in f3f9d03edf (4.2) and
8ed25d65ea (5.0).

Backport of 34b411762b from main
2023-10-30 11:08:03 +01:00
Mariusz Felisiak
00805ff436 [5.0.x] Fixed #34923 -- Avoided initializing LEVEL_TAGS when importing django.contrib.messages.
Regression in b7fe36ad37.

Thanks James Gillard for the report.

Backport of 311718feb5 from main
2023-10-24 14:12:40 -03:00
Nick Pope
cc5901fa8e [5.0.x] Fixed #34899 -- Added blank choice to forms' callable choices lazily.
Backport of 171f91d9ef from main
2023-10-23 14:54:37 -03:00
Nick Pope
bbe90f3c00 [5.0.x] Refs #34899 -- Extracted Field.flatchoices to flatten_choices helper function.
Co-authored-by: Natalia Bidart <124304+nessita@users.noreply.github.com>

Backport of 74afcee234 from main
2023-10-23 14:53:13 -03:00
Nick Pope
711c054722 [5.0.x] Refs #31262 -- Added __eq__() and __getitem__() to BaseChoiceIterator.
This makes it easier to work with lazy iterators used for callables,
etc. when extracting items or comparing to lists, e.g. during testing.

Also added `BaseChoiceIterator.__iter__()` to make it clear that
subclasses must implement this and added `__all__` to the module.

Co-authored-by: Adam Johnson <me@adamj.eu>
Co-authored-by: Natalia Bidart <124304+nessita@users.noreply.github.com>

Backport of 07fa79ef2b from main
2023-10-23 14:51:27 -03:00
David Sanders
4dec7eded9 [5.0.x] Fixed #34921 -- Fixed crash of warning for unbound naive datetimes.
Backport of b5311ee232 from main
2023-10-22 19:34:13 +02:00
laserhyena
bba963df50 [5.0.x] Fixed #34911 -- Corrected HTML heading levels on admindocs' main page.
Backport of 21382e2743 from main
2023-10-20 06:20:32 +02:00
ontowhee
31bdf67a9c [5.0.x] Fixed #34905 -- Corrected admin's main content element rendered in <main> tag.
Regression in 91e617c743.

Thanks Tom Carrick for the report.
Backport of 89d2ae257b from main
2023-10-19 17:26:15 +02:00
Mariusz Felisiak
448510a94b [5.0.x] Refs #34900, Refs #34118 -- Updated assertion in test_skip_class_unless_db_feature() test on Python 3.12.1+.
Python 3.12.1+ no longer includes skipped tests in the number of
running tests. Check out:

https://github.com/python/cpython/issues/110890#issuecomment-1763458686
https://github.com/python/cpython/pull/106588
Backport of 20b7aac7ca from main
2023-10-16 06:28:13 +02:00
Simon Charette
4ccca9eedc [5.0.x] Fixed #34798 -- Fixed QuerySet.aggregate() crash when referencing expressions containing subqueries.
Regression in 59bea9efd2,
complements e5c844d6f2.

Refs #28477, #34551.

Thanks Haldun Komsuoglu for the report.

Backport of 3b4a571275 from main
2023-10-16 06:15:08 +02:00
Mariusz Felisiak
c3cf518a80 [5.0.x] Refs #34840 -- Fixed test_validate_nullable_textfield_with_isnull_true() on databases that don's support table check constraints.
Thanks Tim Graham for the report.
Backport of 9fd3a0ffc8 from main
2023-10-12 20:02:02 +02:00
Mariana
0bbe6ca2ac [5.0.x] Fixed #12241 -- Preserved query strings when using "Save and continue/add another" in admin.
Co-authored-by: Grady Yu <gradyy@users.noreply.github.com>
Co-authored-by: David Sanders <shang.xiao.sanders@gmail.com>
Co-authored-by: Matthew Newton <matthewn@berkeley.edu>

Backport of fc62e17778 from main
2023-10-11 12:46:10 +02:00
Mariusz Felisiak
bcc6a8ee88 [5.0.x] Refs #34882 -- Fixed GISFunctionsTests.test_asgeojson_option_0() test on Oracle.
This uses an example with the same precision for all databases.

Follow up to 96e7a752b6.
Backport of 6e369f36f2 from main
2023-10-11 12:45:44 +02:00
Mariusz Felisiak
9f8bf7aebe [5.0.x] Fixed #34889 -- Fixed get_prefetch_queryset() fallback in prefetch_one_level().
Thanks Matt Westcott for the report.

Regression in cac94dd8aa.
Backport of 296b75a3c0 from main
2023-10-06 20:19:59 +02:00
Denis Rouzaud
df3f97a7d6 [5.0.x] Fixed #34882 -- Fixed no options in AsGeoJSON() for geometries in non-default CRS.
Backport of 96e7a752b6 from main
2023-10-06 05:27:04 +02:00
pieterck
72a2044b40 [5.0.x] Fixed #34759 -- Confirmed support for SpatiaLite 5.1.
Thanks The Epic Dev for helping with tests.

Backport of 0989cf13e7 from main.
2023-10-05 18:15:47 +02:00
Simon Charette
458bc9e768 [5.0.x] Refs #33482 -- Fixed QuerySet selecting and filtering againts Exists() with empty queryset.
Thanks Tobias Bengfort for the report.
Backport of ea596a52d9 from main
2023-10-04 21:32:35 +02:00
Natalia
8124c42601 [5.0.x] Fixed CVE-2023-43665 -- Mitigated potential DoS in django.utils.text.Truncator when truncating HTML text.
Thanks Wenchao Li of Alibaba Group for the report.
2023-10-04 09:38:26 -03:00
Dan Jacob
e60fe3bb05 [5.0.x] Fixed #34878 -- Fixed autoreloader crash when FORM_RENDERER is set to TemplatesSetting.
Regression in 439242c594.

Backport of fe835c2355 from main
2023-09-29 06:36:59 +02:00
Paolo Melchiorre
0f9d07398d [5.0.x] Fixed #34877 -- Fixed migrations crash when adding GeneratedField with output_field with params.
Backport of e7e8eb44a3 from main
2023-09-28 08:12:39 +02:00
David Sanders
bc6d71d4de [5.0.x] Fixed #34825 -- Avoided setting unused connections when initializing parallel workers.
Backport of a5905b164d from main
2023-09-25 11:10:17 +02:00
David Sanders
4910920869 [5.0.x] Fixed #34849 -- Avoided raising RuntimeWarning about import-time queries when apps are reinitialized with test tools.
Regression in fbd16438f4.

Backport of 4f2ae0644d from main
2023-09-25 09:14:05 +02:00
Paolo Melchiorre
81663cc4ca [5.0.x] Fixed #34861 -- Fixed crash when adding GeneratedField with some expressions.
Co-authored-by: Simon Charette <charette.s@gmail.com>

Backport of 574ee4023e from main
2023-09-22 21:37:01 +02:00
Arian
7683c86351 [5.0.x] Fixed #34823 -- Fixed assertTemplateUsed() context manager crash on unnamed templates.
Backport of 51d703a27f from main
2023-09-22 11:46:47 +02:00
toan
dcd3a0316b [5.0.x] Fixed #34858 -- Corrected resolving output_field for PositiveIntegerField.
Regression in 40b8a6174f.

Backport of 4de31ec680 from main
2023-09-22 10:09:19 +02:00
Natalia
88992c5ac6 [5.0.x] Fixed #34848 -- Ignored i18n_catalog.js file when building Django's translations catalog.
Backport of d797243663 from main
2023-09-22 08:55:11 +02:00
Tim Graham
41d82fda2a [5.0.x] Fixed JSONField's test_deep_distinct for DatabaseFeatures.nulls_order_largest=False.
Failure observed on CockroachDB.
Backport of b0788a0918 from main
2023-09-22 06:26:23 +02:00
Mariusz Felisiak
2566f92544 [5.0.x] Fixed #34840 -- Avoided casting string base fields on PostgreSQL.
Thanks Alex Vandiver for the report.

Regression in 09ffc5c121.

Backport of 779cd28acb from main.
2023-09-22 06:03:19 +02:00
Mariusz Felisiak
b5b361ab3b [5.0.x] Isolated test models for GeneratedFields.
Test regression in f333e3513e.
Backport of 8af3ae4ad9 from main
2023-09-19 08:10:03 +02:00
Clément Escolano
cac94dd8aa Fixed #33651 -- Added support for prefetching GenericForeignKey.
Co-authored-by: revanthgss <revanthgss@almabase.com>
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2023-09-18 13:23:21 +02:00
Ryanwalker277
225328efd9 Fixed #31558 -- Added support for boolean attribute on properties in ModelAdmin.list_display. 2023-09-16 20:54:26 +02:00
Paolo Melchiorre
2f1ab16be5 Fixed #34842 -- Fixed ModelAdmin.readonly_fields crash with GeneratedFields. 2023-09-16 20:13:02 +02:00
Sarah Abderemane
814e7bc220 Fixed #34832 -- Made admin's header content render in <header> tag.
Header tag was changed to <header> get the landmark banner for
accessibility.
2023-09-15 05:36:43 +02:00
Paolo Melchiorre
68d769e691 Fixed #34838 -- Corrected output_field of resolved columns for GeneratedFields.
Thanks Simon Charette for the implementation idea.
2023-09-14 21:17:12 +02:00
Lemuel Sta Ana
969ecb8236 Fixed #34834 -- Added role="search" to the admin changelist search form. 2023-09-14 20:35:48 +02:00
Natalia
691f70c477 Fixed #24561 -- Added support for callables on model fields' choices. 2023-09-14 10:15:33 -03:00
Sarah Abderemane
91e617c743 Fixed #34833 -- Made admin's main content render in <main> tag. 2023-09-14 05:41:31 +02:00
Nick Pope
f92e68c30a Fixed #34822 -- Added support for serializing functions decorated with functools.lru_cache in migrations.
`@functools.cache` and `@functools.lru_cache` return an object of type
`functools._lru_cache_wrapper` which prevented the migrations serializer from
working. Simply using the existing `FunctionTypeSerializer` for this additional
type works as expected.
2023-09-13 15:57:18 -03:00
Nick Pope
c131949e3e Refs #34822 -- Added tests for serializing decorated functions in migrations.
Functions decorated with a decorator that is properly wrapped, e.g. by
using `@functools.wraps`, are already supported.
2023-09-13 15:39:56 -03:00
Mariusz Felisiak
0e540fca13
Corrected logger in CsrfViewMiddlewareTestMixin.test_ensures_csrf_cookie_no_logging().
Logger was changed in 55fec16aaf.
2023-09-13 13:49:01 +02:00
Ben Lomax
74f7deec9e Refs #31949 -- Made make_middleware_decorator to work with async functions. 2023-09-13 11:41:01 +02:00
Ben Lomax
059cb0dbc9 Added more tests for decorators. 2023-09-13 10:16:01 +02:00
Nick Pope
fe19b33e2f Modernized enumeration helpers on Python 3.11+.
- use @enum.property

https://docs.python.org/3/library/enum.html#enum.property

- use @enum.nonmember

Using @property on an enum class does not yield the expected result.
do_not_call_in_templates attribute works because a @property instance
is truthy. We can make this a literal True value as expected by using
@enum.nonmember in Python 3.11+.

https://docs.python.org/3/library/enum.html#enum.nonmember

- used enum.IntEnum/StrEnum

Python 3.11+ has ReprEnum which uses int.__str__() and str.__str__()
for __str__() in the `IntEnum` and `StrEnum` subclasses. We can emulate
that for Python < 3.11.

https://docs.python.org/3/library/enum.html#enum.ReprEnum
https://docs.python.org/3/library/enum.html#enum.IntEnum
https://docs.python.org/3/library/enum.html#enum.StrEnum
2023-09-13 08:30:21 +02:00
Nick Pope
e15174983a Renamed ChoicesMeta to ChoicesType.
This also uses enum.EnumType for Python 3.11+ as Python 3.11 renamed
EnumMeta to EnumType. While the former is still available as an alias
of the latter for now, let's prefer the canonical name for this.

Check out https://docs.python.org/3/library/enum.html#enum.EnumType
2023-09-12 11:51:01 +02:00
Sam Toyer
64cea1e48f Fixed #34752 -- Fixed handling ASGI http.disconnect for streaming responses. 2023-09-11 19:53:21 +02:00