Commit Graph

12955 Commits

Author SHA1 Message Date
David Smith b05dfc2894
Refs #34381, Refs #10929 -- Fixed postgres_tests.test_aggregates.TestGeneralAggretate.test_empty_result_set() on PostgreSQL 14+.
Follow up to 0be8095b25.
2023-03-05 19:06:21 +01:00
Mariusz Felisiak 2660bc19f3
Refs #32539 -- Fixed facet filter tests on Oracle.
Follow up to 868e2fcdda.
2023-03-05 13:19:09 +01:00
Mariusz Felisiak 61f599aeb9
Refs #34381 -- Fixed isolation of MigrateTests.test_migrate_fake_initial(). 2023-03-04 13:09:38 +01:00
sarahboyce 868e2fcdda Fixed #32539 -- Added toggleable facet filters to ModelAdmin.
Thanks Carlton Gibson, Simon Willison, David Smith, and Mariusz
Felisiak for reviews.
2023-03-03 20:24:57 +01:00
sarahboyce 50ca4defcb Added test for preserving popup by reset link in the admin changelist. 2023-03-03 10:18:15 +01:00
Mariusz Felisiak 52e54860bf
Moved duplicate user declarations to setUpTestData() in AdminSiteFinalCatchAllPatternTests. 2023-03-03 10:08:06 +01:00
Dominique Bischof 17e08b2177 Fixed #34377 -- Fixed preserving query strings in AdminSite.catch_all_view().
Included full path when redirecting with append slash to include query
strings.

Regression in ba31b01034.
2023-03-03 08:18:54 +01:00
Dominique Bischof 4338b6526d Refs #31747 -- Added more tests for preserving query strings when redirect with APPEND_SLASH in admin. 2023-03-03 08:18:54 +01:00
Ekaterina Vahrusheva 55bcbd8d17 Fixed #34378 -- Made QuerySet.in_bulk() not clear odering when id_list is passed.
This reverts 340eaded4e.
2023-03-03 06:00:10 +01:00
Heath Henley 56e5ea805b
Fixed #34374 -- Fixed GIS tests on Windows. 2023-03-02 19:14:24 +01:00
Simon Charette c67ea79aa9 Fixed #34368 -- Made subquery raise NotSupportedError when referencing outer window expression.
Regression in f387d024fc.

Co-authored-by: Jannis Vajen <jvajen@gmail.com>
2023-02-27 07:18:58 +01:00
Simon Charette b15f162f25
Fixed #34372 -- Fixed queryset crash on order by aggregation using OrderBy.
Regression in 278881e376 caused by a lack
of expression copying when an OrderBy expression is explicitly provided.

Thanks Jannis Vajen for the report and regression test.
2023-02-27 07:10:19 +01:00
Laurent Tramoy 2276ec8c21 Fixed #34366 -- Reduced AlterField operations when optimizing migrations. 2023-02-24 13:59:42 +01:00
Mariusz Felisiak 2c428b37ae
Refs #34338 -- Fixed isolation of constraints tests.
Regression in 5b3d3e400a.
2023-02-24 09:02:45 +01:00
Tim Graham 40e88ae8c8
Refs #34320 -- Added skipIf for a test requiring check constraints. 2023-02-24 06:00:00 +01:00
Mariusz Felisiak 16c966ff7f
Refs #30060, Refs #34217 -- Made SchemaEditor not generate SQL for CheckConstraint if not supported.
The new logic mirrors the logic in SchemaEditor._delete_check_sql()
added in 68ef274bc5.

Thanks Tim Graham for the report.
2023-02-23 21:12:17 +01:00
Xavier Fernandez 5b3d3e400a Fixed #34338 -- Allowed customizing code of ValidationError in BaseConstraint and subclasses. 2023-02-23 10:58:20 +01:00
Xavier Fernandez 51c9bb7cd1 Refs #33829 -- Added violation_error_message to constraints' __repr__(). 2023-02-23 05:35:58 +01:00
Panagiotis H.M. Issaris dcd9746983
Fixed #34363 -- Fixed floatformat crash on zero with trailing zeros.
Regression in 08c5a78726.
Follow up to 4b066bde69.
2023-02-22 20:46:16 +01:00
Xavier Fernandez ad18a0102c Fixed #34355 -- Deprecated passing positional arguments to BaseConstraint. 2023-02-22 09:37:58 +01:00
Mariusz Felisiak 96bc4254ee
Refs #31445 -- Added test for nesting QuerySet.union().
This was fixed in MySQL 8.0.31.
2023-02-21 12:47:52 +01:00
Mariusz Felisiak 5afd8c6940
Refs #16969 -- Added test for not initializing PostGIS-specific stuff for non-db connections. 2023-02-21 08:42:28 +01:00
Laurens Verhoeven 6cbc403b8e Fixed #34349 -- Fixed FormSet.empty_form crash when deleting extra forms is disabled. 2023-02-20 09:04:29 +01:00
Simon Charette 278881e376 Fixed #34346 -- Ordered selected expressions by position.
Used the same approach as for #34176 by using selected expressions
position to prevent ambiguous aliases in collisions.

Thanks henribru for the report.

Regression in 04518e310d.
2023-02-20 05:54:25 +01:00
Simon Charette a6511bc233 Refs #33308 -- Added tests for queryset ordered by annotation with nulls_first/nulls_last. 2023-02-18 16:28:10 +01:00
Stefan Brand eacf6b73d8 Fixed #34302 -- Fixed SpatialReference.srid for objects without top-level authority. 2023-02-17 19:56:29 +01:00
Stefan Brand d77762de03 Refs #34302 -- Fixed SpatialReference.auth_name()/auth_code() when target is None.
force_bytes() turns None into the byte string b"None". Since
ctypes.c_char_p() also accepts None, we can bypass force_bytes() if
target is None.
2023-02-17 19:56:29 +01:00
Alexandre Spaeth 52b054824e Fixed #34342, Refs #33735 -- Fixed test client handling of async streaming responses.
Bug in 0bd2c0c901.

Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
2023-02-17 10:48:04 +01:00
Alexandre Spaeth bfb8fda3e6 Refs #34342 -- Added tests for handling sync streaming responses by test client.
Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
2023-02-17 10:48:00 +01:00
Nick Pope 8eef22dfed Fixed #34343 -- Moved built-in templates to filesystem. 2023-02-17 09:50:50 +01:00
Durval Carvalho 85366fbca7 Fixed #34045 -- Improved accessibility of selecting items in admin changelist.
This adds "aria-label".
2023-02-16 08:29:40 +01:00
nabil-rady 6bdc3c58b6 Fixed #34320 -- Make sure constraints names are obtained from truncated columns names. 2023-02-15 16:51:31 +01:00
Marcelo Galigniana f9f0092346 Completed test coverage for django.utils.datastructures. 2023-02-15 07:45:00 +01:00
Marcelo Galigniana f608e6a157 Completed test coverage for django.db.migrations.graph. 2023-02-15 07:40:19 +01:00
Marcelo Galigniana 5b23d6666e Completed test coverage for django.forms.utils. 2023-02-15 07:36:05 +01:00
DevilsAutumn ff3a283422 Fixed #34250 -- Fixed renaming model with m2m relation to a model with the same name. 2023-02-14 14:08:06 +01:00
tschilling c5808470aa Fixed #34280 -- Allowed specifying different field values for create operation in QuerySet.update_or_create(). 2023-02-14 11:50:35 +01:00
Markus Holtermann 85ac33591c Fixed CVE-2023-24580 -- Prevented DoS with too many uploaded files.
Thanks to Jakob Ackermann for the report.
2023-02-14 08:18:40 +01:00
sarahboyce e678046681 Fixed #34316 -- Fixed layout of admin password change forms and help texts.
Regression in 96a598356a.
2023-02-13 09:41:31 +01:00
Paolo Melchiorre 69352d85fa
Fixed #33213 -- Doc'd testing code coverage in parallel and used it. 2023-02-11 09:43:26 +01:00
Dhanush a18d20ca97 Fixed #32813 -- Made runserver display port after binding.
Thanks Florian Apolloner for the review.
2023-02-10 08:22:34 +01:00
Jacob Rief 473283d241
Fixed #34303 –- Allowed customizing admin site log entry list.
Added AdminSite.get_log_entries() as an override point and made this
available to the template via each_context().
2023-02-08 18:37:32 +01:00
Mariusz Felisiak 2fd755b361
Fixed #34319 -- Fixed Model.validate_constraints() crash on ValidationError with no code.
Thanks Mateusz Kurowski for the report.

Regression in 667105877e.
2023-02-08 16:38:55 +01:00
Bakdolot 325c44ac6c Fixed #34315 -- Preserved admin changelist filters on "Close" button. 2023-02-08 09:38:14 +01:00
Bernhard M. Wiedemann b4cdcbf239 Removed hardcoded date in SetCookieTests.test_far_expiration().
Follow up to a92c838287.
2023-02-07 20:30:00 +01:00
Nils VAN ZUIJLEN ae1fe72e9b Fixed #34285 -- Fixed index/slice lookups on filtered aggregates with ArrayField.
Thanks Simon Charette for the review.
2023-02-07 13:16:41 +01:00
Jacob Walls 4403432b75 Fixed #33638 -- Fixed GIS lookups crash with geography fields on PostGIS. 2023-02-07 11:48:10 +01:00
Frederic Mheir 2878938626 Fixed #34301 -- Made admin's submit_row check add permission for "Save as new" button. 2023-02-07 07:01:10 +01:00
Mariusz Felisiak 5e9aded33f
Increased the default PBKDF2 iterations for Django 5.0.
Follow up to 9a1848f48c.
2023-02-04 13:37:44 +01:00
Adam Johnson 017fa23d3b Fixed #34259 -- Passed called_from_command_line to command subparsers. 2023-02-03 06:56:57 +01:00
skidipap 1250483ebf Fixed #34286 -- Fixed admindocs markups for case-sensitive template/view names. 2023-02-02 13:21:08 +01:00
David Smith 097e3a70c1 Refs #33476 -- Applied Black's 2023 stable style.
Black 23.1.0 is released which, as the first release of the year,
introduces the 2023 stable style. This incorporates most of last year's
preview style.

https://github.com/psf/black/releases/tag/23.1.0
2023-02-01 11:04:38 +01:00
Nick Pope 8c660fb592 Fixed CVE-2023-23969 -- Prevented DoS with pathological values for Accept-Language.
The parsed values of Accept-Language headers are cached in order to
avoid repetitive parsing. This leads to a potential denial-of-service
vector via excessive memory usage if the raw value of Accept-Language
headers is very large.

Accept-Language headers are now limited to a maximum length in order
to avoid this issue.
2023-02-01 09:44:04 +01:00
sag᠎e 110b3b8356
Fixed #34304 -- Made MySQL's SchemaEditor.remove_constraint() don't create foreign key index when unique constraint is ignored.
Regression in b731e88415.
2023-01-31 11:52:07 +01:00
Stanislav Volyk 20a0850099 Fixed #34283 -- Escaped title in admin's changelist filters.
Regression in 27aa7035f5.
2023-01-30 09:37:53 +01:00
Sarah Boyce 8acc433e41
Fixed #28054 -- Made runserver not return response body for HEAD requests.
Co-authored-by: jannschu <jannik.schuerg@posteo.de>
2023-01-27 21:49:54 +01:00
Raj Desai 246eb4836a Fixed #34254 -- Fixed return value of Exists() with empty queryset.
Thanks Simon Charette for reviews.
2023-01-26 19:54:48 +01:00
Mariusz Felisiak 2b1242abb3
Fixed #34291 -- Fixed Meta.constraints validation crash on UniqueConstraint with ordered expressions.
Thanks Dan F for the report.

Bug in 667105877e.
2023-01-26 09:31:40 +01:00
朱穆穆 d3c93cdc59 Fixed #34227 -- Fixed QuerySet.select_related() with multi-level FilteredRelation. 2023-01-24 10:20:27 +01:00
Matt Westcott ef85b6bf0b Fixed #34192 -- Preserved callable storage when it returns default_storage. 2023-01-23 10:29:17 +01:00
Francesco Panico cc8aa6bf9c Fixed #34267 -- Fixed sliced QuerySet.union() crash.
Regression in 3d734c09ff.

Thanks Raphaël Stefanini for the report.
2023-01-20 08:51:38 +01:00
Niccolò Mineo 79c298c9ce Fixed #34266 -- Added ClosestPoint GIS database functions. 2023-01-20 08:13:43 +01:00
David Wobrock 4b066bde69 Fixed #34272 -- Fixed floatformat crash on zero with trailing zeros to zero decimal places.
Regression in 08c5a78726.

Thanks Andrii Lahuta for the report.
2023-01-19 10:15:40 +01:00
Nick Pope 1e62a64202 Refs #32528 -- Simplified Media.merge().
This avoids building up a second datastructure for the duplicate files
warning case and simply flatten and strip duplicates if that case ever
arises.
2023-01-19 06:33:39 +01:00
Nick Pope 1282b5e420 Fixed #32528 -- Replaced django.utils.topological_sort with graphlib.TopologicalSort().
graphlib.TopologicalSort() is available since Python 3.9.
2023-01-19 06:31:40 +01:00
Mariusz Felisiak 23e8868862
Refs #34233 -- Used str.removeprefix()/removesuffix(). 2023-01-18 19:11:18 +01:00
Nick Pope fd21f82aa8
Refs #34233 -- Used types.NoneType.
Available since Python 3.10 where it was reintroduced.
2023-01-18 17:27:23 +01:00
Nick Pope 26a395f27d
Refs #34233 -- Used aiter() and anext().
Available since Python 3.10.
2023-01-18 13:45:07 +01:00
Mariusz Felisiak b209518089
Refs #32339 -- Deprecated transitional form renderers. 2023-01-18 11:08:39 +01:00
Mariusz Felisiak 3bbe22dafc
Fixed #34233 -- Dropped support for Python 3.8 and 3.9. 2023-01-18 09:46:01 +01:00
Mariusz Felisiak 4fc711a108 Increased the default PBKDF2 iterations for Django 5.0. 2023-01-17 11:49:15 +01:00
Mariusz Felisiak f39f120302 Advanced deprecation warnings for Django 5.0. 2023-01-17 11:49:15 +01:00
Mariusz Felisiak 003081468e Refs #33263 -- Removed warning in BaseDeleteView when delete() method is overridden. 2023-01-17 11:49:15 +01:00
Mariusz Felisiak 94ad46e9d8 Refs #33543 -- Made Expression.asc()/desc() and OrderBy raise ValueError when nulls_first/nulls_last=False is passed.
Per deprecation timeline.
2023-01-17 11:49:15 +01:00
Mariusz Felisiak 98756c685e Refs #32339 -- Changed default form and formset rendering style to div-based.
Per deprecation timeline.

This also removes "django/forms/default.html" and
"django/forms/formsets/default.html" templates.
2023-01-17 11:49:15 +01:00
Mariusz Felisiak b5ac6e78f8 Refs #33691 -- Removed django.contrib.auth.hashers.CryptPasswordHasher per deprecation timeline. 2023-01-17 11:49:15 +01:00
Mariusz Felisiak 71d1203b07 Refs #33348 -- Removed support for passing response object and form/formset name to SimpleTestCase.assertFormError()/assertFormSetError().
Per deprecation timeline.
2023-01-17 11:49:15 +01:00
Mariusz Felisiak d6816bff73 Refs #32365 -- Removed django.utils.timezone.utc per deprecation timeline. 2023-01-17 11:49:15 +01:00
Mariusz Felisiak 9a01311d20 Refs #15619 -- Removed support for logging out via GET requests.
Per deprecation timeline.
2023-01-17 11:49:15 +01:00
Mariusz Felisiak ba082e0952 Refs #33561 -- Made created=True required in signature of RemoteUserBackend.configure_user() subclasses.
Per deprecation timeline.
2023-01-17 11:49:15 +01:00
Mariusz Felisiak 4d78d7338c Refs #31486 -- Removed ability to pass unsaved model instances to related filters.
Per deprecation timeline.
2023-01-17 11:49:15 +01:00
Mariusz Felisiak 1391356276 Refs #29984 -- Made QuerySet.iterator() without chunk_size raise ValueError after prefetch_related().
Per deprecation timeline.
2023-01-17 11:49:15 +01:00
Mariusz Felisiak b119f4329c Refs #29708 -- Removed PickleSerializer per deprecation timeline. 2023-01-17 11:49:15 +01:00
Mariusz Felisiak 23c8787439 Refs #33348 -- Removed support for passing errors=None to SimpleTestCase.assertFormError()/assertFormsetErrors().
Per deprecation timeline.
2023-01-17 11:49:15 +01:00
Mariusz Felisiak 23ec318988 Refs #33342 -- Removed ExclusionConstraint.opclasses per deprecation timeline. 2023-01-17 11:49:15 +01:00
Mariusz Felisiak 5c10041f46 Refs #30127 -- Removed name argument for django.utils.functional.cached_property().
Per deprecation timeline.
2023-01-17 11:49:15 +01:00
Mariusz Felisiak e01970e9d2 Refs #32800 -- Removed CSRF_COOKIE_MASKED transitional setting per deprecation timeline. 2023-01-17 11:49:15 +01:00
Mariusz Felisiak daf88e778b Refs #25916 -- Removed SitemapIndexItem.__str__() per deprecation timeline. 2023-01-17 11:49:15 +01:00
Mariusz Felisiak 31878b4d73 Refs #31026 -- Removed ability to return string when rendering ErrorDict/ErrorList.
Per deprecation timeline.
2023-01-17 11:49:15 +01:00
Mariusz Felisiak 182d25eb7a Refs #31026 -- Removed BaseForm._html_output() per deprecation timeline. 2023-01-17 11:49:15 +01:00
Mariusz Felisiak 4982958ec0 Refs #27674 -- Removed GeoModelAdmin and OSMGeoAdmin per deprecation timeline. 2023-01-17 11:49:15 +01:00
Mariusz Felisiak 2fad163257 Refs #32365 -- Removed is_dst argument for various methods and functions.
Per deprecation timeline.
2023-01-17 11:49:15 +01:00
Mariusz Felisiak e6f82438d4 Refs #32365 -- Removed support for pytz timezones per deprecation timeline. 2023-01-17 11:49:15 +01:00
Mariusz Felisiak 8d98f99a4a Refs #32873 -- Removed settings.USE_L10N per deprecation timeline. 2023-01-17 11:49:15 +01:00
Mariusz Felisiak 0be8095b25 Refs #10929 -- Stopped forcing empty result value by PostgreSQL aggregates.
Per deprecation timeline.
2023-01-17 11:49:15 +01:00
Mariusz Felisiak 43b01300b7 Refs #32655 -- Removed extra_tests argument for DiscoverRunner.build_suite()/run_tests().
Per deprecation timeline.
2023-01-17 11:49:15 +01:00
Mariusz Felisiak 4eb97a90f0 Refs #32375 -- Changed default sitemap protocol to https.
Per deprecation timeline.
2023-01-17 11:49:15 +01:00
Mariusz Felisiak 602d9a312f Refs #32379 -- Changed default USE_TZ to True.
Per deprecation timeline.
2023-01-17 11:49:15 +01:00
Mariusz Felisiak 4aa0689080 Refs #32738 -- Removed django.utils.datetime_safe module per deprecation timeline. 2023-01-17 11:49:15 +01:00
Mariusz Felisiak ef46f3778a Refs #32712 -- Removed django.utils.baseconv module per deprecation timeline. 2023-01-17 11:49:15 +01:00
Mariusz Felisiak 6c0539ed7c Refs #32446 -- Removed SERIALIZE test database setting per deprecation timeline. 2023-01-17 11:49:15 +01:00
Mariusz Felisiak 0e2649fdf4 Fixed #34255 -- Made PostgreSQL backend use client-side parameters binding with psycopg version 3.
Thanks Guillaume Andreu Sabater for the report.

Co-authored-by: Florian Apolloner <apollo13@users.noreply.github.com>
2023-01-17 08:24:08 +01:00
Mariusz Felisiak c8a76059ff Refs #34255 -- Bumped required psycopg version to 3.1.8. 2023-01-17 08:24:08 +01:00
sarahboyce 05bcd5baaf Refs #30129 -- Added test for create() with F() expression in Subquery.
Fixed in 3543129822.
2023-01-16 08:26:34 +01:00
Leo 5da5f3773e Fixed #34234 -- Dropped support for PROJ 4. 2023-01-13 12:31:41 +01:00
Mariusz Felisiak c2118d72d6
Fixed #34240 -- Preserved headers of requests made with django.test.Client in assertRedirects().
Bug in 67da22f08e.
2023-01-13 11:30:27 +01:00
Jarosław Wygoda 32940d390a Refs #26029 -- Deprecated DEFAULT_FILE_STORAGE and STATICFILES_STORAGE settings. 2023-01-12 09:58:36 +01:00
Jarosław Wygoda 1ec3f0961f Fixed #26029 -- Allowed configuring custom file storage backends. 2023-01-12 06:20:57 +01:00
Mariusz Felisiak d02a9f0cee
Fixed thread termination in servers.tests.LiveServerPort on Python 3.10.9+, 3.11.1+, and 3.12+.
Class cleanups registered in TestCase subclasses are no longer called
as TestCase.doClassCleanups() only cleans up the particular class, see

c2102136be
2023-01-12 06:04:10 +01:00
Mariusz Felisiak 829f4d1448
Refs #31546, Refs #34118 -- Corrected CommandTests.test_requires_system_checks_specific().
System checks are never called without skip_checks=False. Moreover,
called_once_with() is not a proper assertion and raise AttributeError
on Python 3.12.
2023-01-11 05:36:40 +01:00
Mariusz Felisiak 552384fa97
Refs #31014 -- Added FromWKB and FromWKT GIS database functions.
Co-authored-by: Ondřej Böhm <ondrej.bohm@firma.seznam.cz>
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Co-authored-by: Sergey Fedoseev <fedoseev.sergey@gmail.com>
2023-01-10 11:51:09 +01:00
Francesco Panico 72efd840a8 Fixed #34110 -- Added in-memory file storage.
Thanks Paolo Melchiorre, Carlton Gibson, and Mariusz Felisiak for
reviews.
2023-01-10 10:56:59 +01:00
Simon Charette dd68af62b2 Fixed #34176 -- Fixed grouping by ambiguous aliases.
Regression in b7b28c7c18.

Refs #31377.

Thanks Shai Berger for the report and reviews.

test_aggregation_subquery_annotation_values_collision() has been
updated as queries that are explicitly grouped by a subquery should
always be grouped by it and not its outer columns even if its alias
collides with referenced table columns. This was not possible to
accomplish at the time 10866a10 landed because we didn't have compiler
level handling of colliding aliases.
2023-01-09 10:52:51 +01:00
Tim Graham 016bead6a2
Renamed 'requests' test package.
This avoids a collision when third-party database backends depend on the
Requests HTTP library.
2023-01-07 11:41:40 +01:00
Nick Pope b47f2f5b90 Fixed #33865 -- Optimized LimitedStream wrapper.
The current implementation of LimitedStream is slow because .read()
performs an extra copy into a buffer and .readline() performs two
extra copies. The stream being wrapped is already typically a BytesIO
object so this is unnecessary.

This implementation has largely been untouched for 12 years and,
inspired by a simpler implementation in werkzeug, it was possible to
achieve the following performance improvement:

LimitedStream.read() (single line):
  Mean +- std dev: [bench_limitedstream-main] 286 ns +- 6 ns
  -> [bench_limitedstream-patch] 227 ns +- 6 ns: 1.26x faster
LimitedStream.readline() (single line):
  Mean +- std dev: [bench_limitedstream-main] 507 ns +- 11 ns
  -> [bench_limitedstream-patch] 232 ns +- 8 ns: 2.18x faster
LimitedStream.read(8192) (single line):
  Mean +- std dev: [bench_limitedstream-main] 360 ns +- 8 ns
  -> [bench_limitedstream-patch] 297 ns +- 6 ns: 1.21x faster
LimitedStream.readline(8192) (single line):
  Mean +- std dev: [bench_limitedstream-main] 602 ns +- 10 ns
  -> [bench_limitedstream-patch] 305 ns +- 10 ns: 1.98x faster
LimitedStream.read() (multiple lines):
  Mean +- std dev: [bench_limitedstream-main] 290 ns +- 5 ns
  -> [bench_limitedstream-patch] 236 ns +- 6 ns: 1.23x faster
LimitedStream.readline() (multiple lines):
  Mean +- std dev: [bench_limitedstream-main] 517 ns +- 19 ns
  -> [bench_limitedstream-patch] 239 ns +- 7 ns: 2.16x faster
LimitedStream.read(8192) (multiple lines):
  Mean +- std dev: [bench_limitedstream-main] 363 ns +- 8 ns
  -> [bench_limitedstream-patch] 311 ns +- 11 ns: 1.17x faster
LimitedStream.readline(8192) (multiple lines):
  Mean +- std dev: [bench_limitedstream-main] 601 ns +- 12 ns
  -> [bench_limitedstream-patch] 308 ns +- 7 ns: 1.95x faster

Geometric mean: 1.59x faster
2023-01-05 19:26:56 +01:00
Nick Pope 57f5669d23 Refs #33865 -- Improved implementation of FakePayload.
FakePayload is a wrapper around io.BytesIO and is expected to
masquerade as though it is a file-like object. For that reason it makes
sense that it should inherit the correct signatures from io.BytesIO
methods.

Crucially an implementation of .readline() is added which will be
necessary for this to behave more like the expected file-like objects as
LimitedStream will be changed to defer to the wrapped stream object
rather than rolling its own implementation for improved performance.

It should be safe to adjust these signatures because FakePayload is
only used internally within test client helpers, is undocumented, and
thus private.
2023-01-05 19:25:25 +01:00
Nick Pope 95182a8593 Refs #33865 -- Corrected signature of ExplodingBytesIO.read().
These subclasses of io.BytesIO should inherit the correct signature.
2023-01-05 19:17:56 +01:00
Nick Pope 7a1543d9f6 Refs #33865 -- Made RequestsTests.test_set_encoding_clears_GET use FakePayload.
The input stream, wsgi.input, must be a file-like object. The existing
implementation of LimitedStream was lax and allowed an empty string to
be passed incorrectly.

See https://wsgi.readthedocs.io/en/latest/definitions.html#envvar-wsgi.input
2023-01-05 19:16:49 +01:00
Mariusz Felisiak 63d1cb0092
Refs #32355 -- Bumped minimum supported versions of 3rd-party packages.
This bumps minimum supported versions of 3rd-party packages to the first
releases to support Python 3.8.
2023-01-05 18:09:33 +01:00
sag᠎e 8cf3831822
Fixed #34243 -- Fixed timesince() crash with timezone-aware dates and interval longer than 1 month.
Regression in 8d67e16493.
2023-01-05 16:38:19 +01:00
Mariusz Felisiak 7d9329935a
Refs #32355 -- Bumped mysqlclient requirement to >= 1.4.3.
mysqlclient 1.4.3 is the first release to support Python 3.8.
2023-01-05 16:34:14 +01:00
Nick Pope 65477fd7da Added support for datetime.date to DateFormat.r(). 2023-01-05 12:51:55 +01:00
Nick Pope 0fdc5d79b6 Simplified django.utils.formats.date_format()/time_format() calls.
This removes redundant get_format() calls and passing a default value
for the format argument.
2023-01-04 11:47:14 +01:00
GianpaoloBranca 8d67e16493
Fixed #33879 -- Improved timesince handling of long intervals. 2023-01-04 11:14:06 +01:00
David Wobrock 99bd5fb4c2 Refs #34074 -- Used headers argument for RequestFactory and Client in docs and tests. 2023-01-04 09:11:36 +01:00
Mike Crute 0b78ac3fc7 Fixed #34200 -- Made the session role configurable on PostgreSQL. 2023-01-03 09:30:53 +01:00
Claude Paroz 2a14b8df39 Fixed #33783 -- Added IsEmpty GIS database function and __isempty lookup on PostGIS. 2023-01-03 05:47:44 +01:00
Mariusz Felisiak 6774e9359c
Fixed #23842 -- Fixed flaky GeoQuerySetTest.test_make_line() test. 2023-01-03 05:46:40 +01:00
Florian Apolloner afa2e28205 Fixed #34235 -- Added ManifestFilesMixin.manifest_hash attribute.
This adds ManifestFilesMixin.manifest_hash attribute exposing a "hash"
of the full manifest. This allows applications to determine when their
static files have changed.
2023-01-02 09:53:52 +01:00
Francesco Panico c179ad9fe7 Refs #34100 -- Made file upload tests use Storage.exists() where appropriate. 2022-12-30 13:28:47 +01:00
Mariusz Felisiak 6e9e7ec472
Fixed random delete.tests.DeletionTests.test_deletion_order failures. 2022-12-30 12:22:30 +01:00
Paul Schilling 298d02a77a Fixed #25617 -- Added case-insensitive unique username validation in UserCreationForm.
Co-Authored-By: Neven Mundar <nmundar@gmail.com>
2022-12-29 09:42:22 +01:00
Adrian Torres 7eee1dca42 Fixed #14094 -- Added support for unlimited CharField on PostgreSQL.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2022-12-28 12:31:04 +01:00
kimsoungryoul 78f163a4fb Fixed #18468 -- Added support for comments on columns and tables.
Thanks Jared Chung, Tom Carrick, David Smith, Nick Pope, and Mariusz
Felisiak for reviews.

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Co-authored-by: Nick Pope <nick@nickpope.me.uk>
2022-12-28 06:28:07 +01:00
DevilsAutumn 68ef274bc5 Fixed #34217 -- Fixed migration crash when removing check constraints on MySQL < 8.0.16. 2022-12-27 07:11:13 +01:00
朱穆穆 bbeeb45161 Fixed #34226 -- Fixed QuerySet.select_related() with multiple FilteredRelations to the OneToOneField. 2022-12-27 06:39:38 +01:00
David Wobrock 5aaad5f39c Fixed #34165 -- Made permissions creation respect the "using" parameter. 2022-12-24 11:58:33 +01:00
Carlton Gibson 0bd2c0c901 Fixed #33735 -- Added async support to StreamingHttpResponse.
Thanks to Florian Vazelle for initial exploratory work, and to Nick
Pope and Mariusz Felisiak for review.
2022-12-22 10:41:12 +01:00
Mariusz Felisiak ae0899be0d
Fixed #34219 -- Preserved Char/TextField.db_collation when altering column type.
This moves setting a database collation to the column type alteration
as both must be set at the same time.

This should also avoid another layer of the column type alteration when
adding database comments support (#18468).
2022-12-22 07:12:17 +01:00
Mariusz Felisiak 3b24a3fa33
Removed unnecessary commas in tests. 2022-12-21 11:41:29 +01:00
Carlton Gibson 32d70b2f55
Refs #34118 -- Adopted asgiref coroutine detection shims.
Thanks to Mariusz Felisiak for review.
2022-12-20 11:10:48 +01:00
Roxane 289e9a75af Fixed #33662 -- Allowed Sitemap to customize languages for each item. 2022-12-19 12:51:52 +01:00
Andreas Pelme ab7a85ac29 Fixed #34170 -- Implemented Heal The Breach (HTB) in GzipMiddleware. 2022-12-17 08:46:37 +01:00
Leo a1bcdc94da Fixed #34212 -- Made RedisCacheClient.incr() use write connection.
Co-authored-by: Sin-Woo Bang <sinwoobang@gmail.com>
2022-12-16 19:13:03 +01:00
Mariusz Felisiak 1e4da43955
Fixed lookup.tests.LookupTests.test_exact_none_transform() test on Oracle.
NulledTransform doesn't return TextField anymore so it cannot be
wrapped with DBMS_LOB.SUBSTR().

Test regression in 09ffc5c121.
2022-12-16 12:24:49 +01:00
Daniele Varrazzo 09ffc5c121 Fixed #33308 -- Added support for psycopg version 3.
Thanks Simon Charette, Tim Graham, and Adam Johnson for reviews.

Co-authored-by: Florian Apolloner <florian@apolloner.eu>
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2022-12-15 06:17:57 +01:00
Marti Raudsepp 32268456d6 Fixed #34209 -- Prevented FileBasedCache.has_key() crash caused by a race condition. 2022-12-13 19:29:15 +01:00
Florian Apolloner db7bb3b64e Refs #33308 -- Added DatabaseOperations.compose_sql() on PostgreSQL. 2022-12-12 10:36:45 +01:00
Florian Apolloner 1d90c9b113 Refs #33308 -- Added psycopg_any.IsolationLevel. 2022-12-12 10:36:42 +01:00
Florian Apolloner 2ebfbd894e Refs #33308 -- Moved psycopg2 imports to the psycopg_any module. 2022-12-12 08:36:17 +01:00
James Gillard c5ed884eab Fixed #34205 -- Fixed Meta.constraints validation crash with ArrayField and __len lookup.
Regression in 88fc9e2826 that began
manifesting in Django 4.1.
2022-12-10 17:46:13 +01:00
SirAbhi13 b8738aea14 Fixed #33199 -- Deprecated passing positional arguments to Signer/TimestampSigner.
Thanks Jacob Walls for the implementation idea.
2022-12-09 12:44:48 +01:00
Mariusz Felisiak 9da2210f12
Avoided direct mocking of psycopg2.__version__ in test_correct_extraction_psycopg2_version(). 2022-12-08 14:31:35 +01:00
Mariusz Felisiak cbc0fb3705
Made inspectdb used Cursor.description.display_size for CharFields' max_length.
internal_size is size for fixed-size types not for char types.
2022-12-08 09:00:35 +01:00
Mariusz Felisiak 95a101a690
Fixed #34201 -- Bumped minimum supported SQLite to 3.21.0. 2022-12-08 05:53:18 +01:00
James Bligh e44d348c99
Fixed #32319 -- Added ES module support to ManifestStaticFilesStorage.
Co-authored-by: James Bligh <james.bligh@silvercloudhealth.com>
2022-12-07 10:56:00 +01:00
Florian Apolloner d8c8761901 Used homogeneous weights list in SearchRank tests.
A homogenous array is required on PostgreSQL.
2022-12-06 12:52:56 +01:00
Daniele Varrazzo c14e5c64c9 Fixed typo in tests/postgres_tests/test_signals.py comment. 2022-12-06 12:52:56 +01:00
Florian Apolloner 6a21658163 Refs #33308 -- Modernized database wrapper in the PostgreSQL backend.
- Used connection.info instead of connection.get_parameter_status() and
  connection.server_info which don't exist in psycopg 3.
- Set encoding using the client_encoding connection parameter instead
  of connection.set_client_encoding() that doesn't exist in psycopg 3.
- Used the dbname connection parameter instead of deprecated
  alias - database.
2022-12-06 12:48:16 +01:00
Mariusz Felisiak 29b6a177d8
Fixed AdminViewDeletedObjectsTest.test_cyclic failure when using --keepdb.
This changes to hardcoded pks when hardcoded fks are used.
2022-12-06 11:14:32 +01:00
Pablo e673c87b56 Fixed #29084 -- Skipped some postgres_tests.test_search tests when pg_catalog isn't English. 2022-12-06 08:26:43 +01:00
Alex Vandiver cbce427c17 Fixed #34194 -- Added django.utils.http.content_disposition_header(). 2022-12-05 13:08:00 +01:00
Pablo 48531f53ae Improved test coverage for django.db.transaction. 2022-12-05 10:46:33 +01:00
Simon Charette eccda63a49 Improved isolation of TestGeneralAggregate.test_default_argument(). 2022-12-02 13:58:46 +01:00
Florian Apolloner 3e3b7f691b Refs #33308 -- Avoided passing None to RawSQL's params.
Passing None to params causes errors in determining the data type on
psycopg3.
2022-12-02 10:56:09 +01:00
Simon Charette 0ff46591ac Refs #33308 -- Deprecated support for passing encoded JSON string literals to JSONField & co.
JSON should be provided as literal Python objects an not in their
encoded string literal forms.
2022-12-01 19:14:00 +01:00
Daniele Varrazzo d3e746ace5 Refs #33308 -- Added get_type_oids() hook and simplified registering type handlers on PostgreSQL. 2022-12-01 11:05:57 +01:00
Florian Apolloner 149b55fefa Refs #33308 -- Ensured type handlers are registered for all PostgreSQL specific tests.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2022-12-01 09:39:46 +01:00
Florian Apolloner 3cafb783f3 Refs #33308 -- Used psycopg's errors instead of errorcodes. 2022-12-01 09:17:33 +01:00
Simon Charette 0db8bf3d60 Refs #10929 -- Fixed aggregates crash when passing strings as defaults.
Previously strings were interpreted as F() expressions and default
crashed with AttributeError:
    'F' object has no attribute 'empty_result_set_value'
2022-11-29 13:08:05 +01:00
Giebisch 85b52d22fd Fixed #33701 -- Added fine-grained error locations to the technical 500 debug page. 2022-11-29 08:40:11 +01:00
sdolemelipone 9d726c7902 Fixed #34187 -- Made UserCreationForm save many-to-many fields. 2022-11-29 05:56:53 +01:00
Mariusz Felisiak 60a7bd8986
Refs #34119 -- Skipped test_callable_default_hidden_widget_value_not_overridden when JSONField is not supported. 2022-11-28 09:47:52 +01:00
David Sanders 64b3c413da Fixed #34103 -- Fixed logging SQL queries with duplicate parameters on Oracle. 2022-11-25 09:42:25 +01:00
Giebisch 80c66e40f7 Fixed #33747 -- Added exception notes to the technical 500 debug page. 2022-11-25 08:16:10 +01:00
Christophe Baldy 70c945d6b3
Used DatabaseFeatures.django_test_skips to skip AssertNumQueriesUponConnectionTests tests. 2022-11-24 19:41:08 +01:00
SirAbhi13 17472c3304 Fixed #34173 -- Skipped saving sessions on 5xx responses. 2022-11-24 15:46:41 +01:00
baldychristophe 855f5a36e7 Fixed #29062 -- Prevented possibility of database lock when using LiveServerTestCase with in-memory SQLite database.
Thanks Chris Jerdonek for the implementation idea.
2022-11-24 10:52:48 +01:00
Simon Charette 1297c0d0d7 Fixed #31679 -- Delayed annotating aggregations.
By avoiding to annotate aggregations meant to be possibly pushed to an
outer query until their references are resolved it is possible to
aggregate over a query with the same alias.

Even if #34176 is a convoluted case to support, this refactor seems
worth it given the reduction in complexity it brings with regards to
annotation removal when performing a subquery pushdown.
2022-11-23 17:46:07 +01:00
Mariusz Felisiak a411b90967
Refs #33050 -- Added test for QuerySet.count() on combined queries with select_related().
Thanks Simon Charette for noticing this.

Fixed in 70499b25c7.
2022-11-23 09:35:48 +01:00
DevilsAutumn 4035bab56f Fixed #34171 -- Fixed QuerySet.bulk_create() on fields with db_column in unique_fields/update_fields.
Bug in 0f6946495a.

Thanks Joshua Brooks for the report.
2022-11-22 14:47:21 +01:00
Mariusz Felisiak 7d5329852f
Fixed #34177 -- Fixed QuerySet.bulk_create() crash on "pk" in unique_fields.
Bug in 0f6946495a.
2022-11-22 14:26:23 +01:00
Ilya Bass 798e38c2b9 Fixed #31090 -- Logged transaction management queries.
Thanks to Petter Strandmark for the original idea and Mariusz Felisiak
for advice during the DjangoConUS 2022 Sprint!
2022-11-21 09:10:14 +01:00
David Sanders 25904db915 Fixed #34119 -- Prevented callable default hidden widget value from being overridden.
Thanks to Benjamin Rigaud for the report.
2022-11-18 13:12:15 +01:00
roman_p 04b15022e8 Fixed #26261 -- Fixed queryset crash when excluding reverse GenericRelation.
Thanks Amir Hadi for the report.
2022-11-18 10:13:31 +01:00
Francesco Panico 51faf4bd17 Fixed #34148 -- Reverted "Fixed #32901 -- Optimized BaseForm.__getitem__()."
This reverts commit edde2a0699.

Thanks Jan Pieter Waagmeester for the report.
2022-11-18 08:06:13 +01:00
Ben Cail fbde929b19 Fixed #26056 -- Added QuerySet.values()/values_list() support for ArrayField's __overlap lookup.
Thanks Mads Jensen and kosz85 and the initial patch.
2022-11-18 05:53:37 +01:00
DevilsAutumn 81b1c167bf Fixed #28987 -- Fixed altering ManyToManyField when changing to self-referential. 2022-11-17 12:36:52 +01:00
Mariusz Felisiak 67504ea505
Refs #34118 -- Skipped not compatible requirements on daily builds for Python 3.12. 2022-11-16 08:16:40 +01:00
Simon Charette 70499b25c7 Fixed #34123 -- Fixed combinator order by alias when using select_related().
Regression in c58a8acd41.

Thanks to Shai Berger for the report and tests.

Co-Authored-By: David Sanders <shang.xiao.sanders@gmail.com>
2022-11-15 10:48:19 +01:00
David Wobrock 67da22f08e Fixed #34074 -- Added headers argument to RequestFactory and Client classes. 2022-11-14 10:21:51 +01:00
Simon Charette 10037130c1
Refs #28477 -- Fixed handling aliased annotations on aggregation.
Just like when using .annotate(), the .alias() method will generate the
necessary JOINs to resolve the alias even if not selected.

Since these JOINs could be multi-valued non-selected aggregates must be
considered to require subquery wrapping as a GROUP BY is required to
combine duplicated tuples from the base table.

Regression in 59bea9efd2.
2022-11-14 05:45:33 +01:00
Simon Charette a9d2d8d1c3 Refs #28477 -- Reduced complexity of aggregation over qualify queries. 2022-11-11 08:46:08 +01:00
Francesco Panico 032c09c414 Refs #34110 -- Reorganized django.core.files.storage into a separate module. 2022-11-11 06:59:33 +01:00
Nick Pope 9bd174b9a7 Updated documentation and comments for RFC updates.
- Updated references to RFC 1123 to RFC 5322
  - Only partial as RFC 5322 sort of sub-references RFC 1123.
- Updated references to RFC 2388 to RFC 7578
  - Except RFC 2388 Section 5.3 which has no equivalent.
- Updated references to RFC 2396 to RFC 3986
- Updated references to RFC 2616 to RFC 9110
- Updated references to RFC 3066 to RFC 5646
- Updated references to RFC 7230 to RFC 9112
- Updated references to RFC 7231 to RFC 9110
- Updated references to RFC 7232 to RFC 9110
- Updated references to RFC 7234 to RFC 9111
- Tidied up style of text when referring to RFC documents
2022-11-10 13:52:17 +01:00
Márton Salomváry d6cbf39a1b Fixed #34149 -- Allowed adding deferrable conditional exclusion constraints on PostgreSQL. 2022-11-10 11:07:24 +01:00
Simon Charette 59bea9efd2 Fixed #28477 -- Stripped unused annotations on aggregation.
Also avoid an unnecessary pushdown when aggregating over a query that doesn't
have aggregate annotations.
2022-11-09 13:22:14 +01:00
Jon Janzen 321ecb40f4 Fixed #34135 -- Added async-compatible interface to related managers. 2022-11-09 10:32:40 +01:00
Scott Halgrim c4eaa67e2b Fixed #34063 -- Fixed reading request body with async request factory and client.
Co-authored-by: Kevan Swanberg <kevswanberg@gmail.com>
Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
2022-11-08 13:53:34 +01:00
Jon Janzen 7b94847e38 Fixed #34139 -- Fixed acreate(), aget_or_create(), and aupdate_or_create() methods for related managers.
Bug in 58b27e0dbb.
2022-11-08 06:20:10 +01:00