Commit Graph

12724 Commits

Author SHA1 Message Date
Marcelo Galigniana 2a2503c2c1 Completed test coverage for django.core.paginator. 2022-10-13 12:27:41 +02:00
Sergio 94e7f471c4 Fixed #34069 -- Made LocaleMiddleware respect language from requests when i18n patterns are used. 2022-10-13 10:38:26 +02:00
Rasmus Magnell c4aac2ac1e Fixed #34042 -- Improved accessibility of admin's navigation sidebar. 2022-10-12 10:21:17 +02:00
Marcelo Galigniana f30c7e381c
Completed test coverage for contenttypes models. 2022-10-11 05:38:39 +02:00
Adam Johnson 6402b064a9 Used test client headers in i18n tests. 2022-10-10 11:46:31 +02:00
Sarah Boyce 84206607d6
Fixed #32833 -- Fixed ContentTypeManager.get_for_models() crash when using in migrations.
Co-authored-by: Heraldo Lucena <23155511+HMaker@users.noreply.github.com>
2022-10-10 08:57:52 +02:00
Gregor Gärtner f0c06f8ab7 Refs #33990 -- Renamed TransactionTestCase.assertQuerysetEqual() to assertQuerySetEqual().
Co-Authored-By: Michael Howitz <mh@gocept.com>
2022-10-08 08:07:38 +02:00
Mariusz Felisiak d795259ea9
Replaced assertQuerysetEqual() to assertSequenceEqual()/assertCountEqual() where appropriate.
Follow up to 3f7b327562.
2022-10-07 13:05:35 +02:00
Gregor Gärtner 564b317fb5 Refs #33990 -- Renamed SimpleTestCase.assertFormsetError() to assertFormSetError().
Co-Authored-By: Michael Howitz <mh@gocept.com>
2022-10-07 11:22:16 +02:00
Mariusz Felisiak 749cd83e13
Removed hardcoded pks in TestQuerying.test_group_by_order_by_aliases test. 2022-10-07 08:26:41 +02:00
Shubh1815 7a39a691e1 Fixed #32603 -- Made ModelAdmin.list_editable use transactions. 2022-10-06 20:44:07 +02:00
Simon Charette c6350d594c Refs #30158 -- Removed alias argument for Expression.get_group_by_cols().
Recent refactors allowed GROUP BY aliasing allowed for aliasing to be
entirely handled by the sql.Query.set_group_by and compiler layers.
2022-10-06 12:04:00 +02:00
Simon Charette b7b28c7c18 Refs #31150 -- Enabled implicit GROUP BY aliases.
This ensures implicit grouping from aggregate function annotations
groups by uncollapsed selected aliases if supported.

The feature is disabled on Oracle because it doesn't support it.
2022-10-06 11:51:32 +02:00
Simon Charette 3d734c09ff Refs #33992 -- Refactored subquery grouping logic.
This required moving the combined queries slicing logic to the compiler
in order to allow Query.exists() to be called at expression resolving
time.

It allowed for Query.exists() to be called at Exists() initialization
time and thus ensured that get_group_by_cols() was operating on the
terminal representation of the query that only has a single column
selected.
2022-10-06 11:38:03 +02:00
Simon Charette 04518e310d Refs #33308 -- Enabled explicit GROUP BY and ORDER BY aliases.
This ensures explicit grouping from using values() before annotating an
aggregate function groups by selected aliases if supported.

The GROUP BY feature is disabled on Oracle because it doesn't support it.
2022-10-06 09:34:31 +02:00
Simon Charette c58a8acd41 Fixed #33768 -- Fixed ordering compound queries by nulls_first/nulls_last on MySQL.
Columns of the left outer most select statement in a combined query
can be referenced by alias just like by index.

This removes combined query ordering by column index and avoids an
unnecessary usage of RawSQL which causes issues for backends that
specialize the treatment of null ordering.
2022-10-05 14:04:49 +02:00
Jack Linke 344d31c7e9 Fixed #34071 -- Improved error message for Range(Min/Max)ValueValidator. 2022-10-05 09:41:01 +02:00
Dhanush 9fbb5b5e16 Fixed #34068 -- Corrected output of runserver command for "0" IP address.
Thanks David Sanders for the review.
2022-10-04 10:13:32 +02:00
Adam Johnson e5ea284294 Fixed CVE-2022-41323 -- Prevented locales being interpreted as regular expressions.
Thanks to Benjamin Balder Bach for the report.
2022-10-04 09:10:04 +02:00
David Sanders 4771a1694b Fixed #34012 -- Made QuerySet.order_by() apply transforms on related fields for models with Meta.ordering.
This makes QuerySet.order_by() no longer ignore trailing transforms for
models with Meta.ordering. As a consequence, FieldError is raised in
such cases for non-existent fields.

Thanks to Klaas van Schelven for the report and Mariusz Felisiak for the
review and advice.
2022-10-04 08:19:34 +02:00
Lily Foote 649b28eab6 Fixed #34070 -- Added subsecond support to Now() on SQLite and MySQL. 2022-10-03 12:13:27 +02:00
Mariusz Felisiak f71b0cf769
Refs #32987 -- Relaxed system check for template tag modules with the same name by turning into a warning.
Thanks Claude Paroz for the report.

Regression in 004b4620f6.
2022-10-03 10:52:21 +02:00
David Wobrock 3b4a5b9f97 Fixed #23353 -- Used "raise from" when raising TransactionManagementError.
This change sets the __cause__ attribute to raised exceptions.
2022-10-03 06:08:54 +02:00
Mariusz Felisiak bc3b8f1524
Refs #34058 -- Fixed changing/deleting sequences when altering pre-Django 4.1 auto fields on PostgreSQL.
Thanks Anders Kaseorg for the report.

Follow up to 19e6efa50b.
Regression in 2eea361eff.
2022-10-01 07:53:32 +02:00
Mariusz Felisiak 5e0aa362d9
Fixed #33984 -- Reverted "Fixed #32980 -- Made models cache related managers."
This reverts 4f8c7fd9d9 and adds
two regression tests:
- test_related_manager_refresh(), and
- test_create_copy_with_m2m().

Thanks joeli for the report.
2022-09-30 18:18:33 +02:00
sarahboyce 6cc0f22a73 Fixed #32095 -- Made QuerySet.update_or_create() save only fields passed in defaults or with custom pre_save().
Thanks Florian Apolloner for the initial patch.
2022-09-30 06:26:19 +02:00
Antoine Lorence 9b0c9821ed Fixed #34062 -- Updated View.http_method_not_allowed() to support async.
As with the options() methods, wrap the response in a coroutine if
the view is async.

Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
2022-09-29 16:28:44 +02:00
Mariusz Felisiak 19e6efa50b
Fixed #34058 -- Changed sequence types when altering pre-Django 4.1 auto fields on PostgreSQL.
Thanks Anders Kaseorg for the report.

Thanks Florian Apolloner for pair programming.

Regression in 2eea361eff.
2022-09-29 13:20:14 +02:00
Adam Johnson 0f5b11eca0 Refs #34010 -- Made --debug-mode work for parallel tests using spawn.
Bug in 3b3f38b3b0.

Thanks Kevin Renskers for the report.
2022-09-28 19:39:25 +02:00
David Sanders 9976f3d4b8 Fixed #34025 -- Fixed selecting ModelAdmin.autocomplete_fields after adding/changing related instances via popups.
Regression in c72f6f36c1.

Thanks Alexandre da Silva for the report.
2022-09-28 11:28:01 +02:00
Mariusz Felisiak 6e891a1722
Removed obsolete test_skip_link_is_skipped_when_there_is_searchbar test.
searchbar doesn't have autofocus since
d938b3b257.
2022-09-28 11:27:11 +02:00
Jacob Walls 80d38de52b Fixed #34051 -- Made makemigrations --check exit before making migrations. 2022-09-28 09:48:07 +02:00
JunKi Yoon 1a7b6909ac Fixed #34052 -- Made migrate --check don't emit signals and output when up to date. 2022-09-27 21:10:30 +02:00
David Wobrock cff1f888e9
Fixed #33464 -- Resolved output_field for combined numeric expressions with MOD operator. 2022-09-27 20:41:10 +02:00
sarahboyce ae3d575ec3 Added tests for QuerySet.update_or_create() with multi-table inheritance. 2022-09-27 12:55:33 +02:00
Marcelo Galigniana 67c34c1a37 Completed test coverage for createsuperuser command. 2022-09-27 09:57:16 +02:00
Adam Johnson cd03e8e2d6 Fixed #34050 -- Replaced invalid chars in migration names with '_'.
Thanks to Bishal Gautam for the report and initial implementation.

Regression in fa58450a9a.

Co-Authored-By: Bishal Gautam <bisalgt@gmail.com>
2022-09-27 08:02:51 +02:00
Moshe Nahmias d938b3b257
Fixed #34040 -- Removed autofocus from admin search box. 2022-09-26 21:06:48 +02:00
Mariusz Felisiak f4e592e383
Removed unnecessary MySQL workaround in timezones tests.
Unnecessary since 22da5f8817.
2022-09-26 13:36:47 +02:00
Florian Perucki 872b61193b Refs #34041 -- Added navigation landmark to breadcrumbs in admin.
Thanks Thibaud Colas for pair programming.
2022-09-26 08:51:15 +02:00
David Sanders 9f8c994851 Fixed #34027 -- Fixed migrations crash when altering type of char/text fields referenced by foreign key on PostgreSQL. 2022-09-25 20:23:01 +02:00
select-case f3822d4ab0
Fixed #34026 -- Fixed WKBReader.read() crash on string input. 2022-09-24 17:16:08 +01:00
David Sanders 1674c70525
Fixed #34024 -- Fixed crash when aggregating querysets with Q objects annotations.
This reverts b64db05b9c.

It was reasonable to assume it was unnecessary code as there were
no failing tests upon its removal. This commit adds the necessary
regression tests for the failing condition identified in #34024
alongside the original tests added in the PR for which
WhereNode.is_summary was introduced.
2022-09-23 15:15:03 +01:00
Mariusz Felisiak 37a13cc92d
Refs #34012 -- Added test for ordering by transform of related fields. 2022-09-22 12:55:47 +02:00
Mariusz Felisiak ce6230aa97
Fixed #34015 -- Allowed filtering by transforms on relation fields. 2022-09-22 00:17:04 +02:00
Alexander Kerkum f88fc72da4 Fixed #34016 -- Fixed QuerySet.values()/values_list() crash on ArrayAgg() and JSONBAgg().
Regression in e06dc4571e.
2022-09-17 19:38:20 +02:00
Kamil Turek ae509f8f08 Fixed #34014 -- Fixed DecimalValidator validating 0 in positive exponent scientific notation.
Thanks Shiplu Mokaddim for the report.
2022-09-17 10:02:55 +02:00
Mariusz Felisiak 229360d7ad
Fixed test_relational_post_delete_signals_happen_before_parent_object when run in isolation. 2022-09-16 11:14:27 +02:00
Allen Jonathan David 10178197d5 Fixed #33966 -- Added support for using KeyTextTransform from lookup. 2022-09-16 05:36:57 +02:00
Anvesh Mishra 6220c445c4 Fixed #29186 -- Fixed pickling HttpRequest and subclasses. 2022-09-14 13:04:34 +02:00
David Sanders e14d08cd89 Fixed #33996 -- Fixed CheckConstraint validation on NULL values.
Bug in 667105877e.

Thanks James Beith for the report.
2022-09-13 12:48:31 +02:00
Sergey Fursov b731e88415 Fixed #31335 -- Fixed removing composed composed Meta constraints/indexes on foreign keys on MySQL. 2022-09-13 10:38:57 +02:00
Sergey Fursov 1b08e9bf7d Refs #31335 -- Added more tests for removing composed Meta constraints/indexes on foreign keys. 2022-09-12 13:52:06 +02:00
Jimmy Angelakos 07ebef566f Refs #34000 -- Optimized handling None values in numberformat.format(). 2022-09-12 13:02:50 +02:00
Jimmy Angelakos e911e0996f Fixed #34000 -- Fixed numberformat.format() crash on empty strings. 2022-09-12 12:54:12 +02:00
DevilsAutumn f3cd252cfc Fixed #33995 -- Fixed FormSet.empty_form crash when empty_permitted is passed to form_kwargs. 2022-09-09 13:51:47 +02:00
DevilsAutumn 32797e7fbf Fixed #33975 -- Fixed __in lookup when rhs is a queryset with annotate() and alias().
This fixes clearing selected fields.
2022-09-09 08:37:46 +02:00
Simon Charette 32536b1324 Fixed #33992 -- Fixed queryset crash when aggregating over a group containing Exists.
A more in-depth solution is likely to make sure that we always GROUP BY
selected annotations or revisit how we use Query.exists() in the Exists
expression but that requires extra work that isn't suitable for a
backport.

Regression in e5a92d400a.

Thanks Fernando Flores Villaça for the report.
2022-09-08 05:50:02 +02:00
Mariusz Felisiak a2e580acf6
Refs #24179 -- Fixed selenium tests for offset of admin selector boxes in fieldset.
Regression in be63c78760.
2022-09-07 12:02:08 +02:00
James Beith 19e838daa8 Fixed #33982 -- Fixed migrations crash when adding model with ExclusionConstraint.
Regression in 0e656c02fe.
2022-09-07 08:40:56 +02:00
SirAbhi13 4a1150b41d Fixed #33616 -- Allowed registering callbacks that can fail in transaction.on_commit().
Thanks David Wobrock and Mariusz Felisiak for reviews.
2022-09-06 12:21:36 +02:00
Mariusz Felisiak 69fa2e8eb2
Refs #26780 -- Made prefetch_related() don't use window expressions fo sliced queries if not supported. 2022-09-06 05:54:35 +02:00
Mark Evans 19e0587ee5 Fixed #33937 -- Optimized serialization of related m2m fields without natural keys. 2022-09-05 20:23:32 +02:00
Allen Jonathan David cd1afd553f Fixed #29799 -- Allowed registering lookups per field instances.
Thanks Simon Charette and Mariusz Felisiak for reviews and mentoring
this Google Summer of Code 2022 project.
2022-09-02 10:02:24 +02:00
Shai Berger fdf0f62521 Fixed ReadOnlyPasswordHashWidget's template for RTL languages. 2022-09-01 21:20:15 +02:00
Mariusz Felisiak 974942a750
Fixed #33955, Fixed #33971 -- Reverted "Fixed #32565 -- Moved internal URLResolver view-strings mapping to admindocs."
This reverts commit 7f3cfaa12b.

Thanks Tom Carrick and Greg Kaleka for reports.
2022-09-01 21:09:16 +02:00
Allen Jonathan David e64919ae54 Refs #29799 -- Added more tests for registering lookups. 2022-09-01 09:59:31 +02:00
Simon Charette b3db6c8dcb Fixed #21204 -- Tracked field deferrals by field instead of models.
This ensures field deferral works properly when a model is involved
more than once in the same query with a distinct deferral mask.
2022-08-30 08:43:53 +02:00
Simon Charette 5d12650ed9 Refs #21204 -- Added more QuerySet.defer()/only() tests for invalid fields. 2022-08-30 07:09:15 +02:00
Mariusz Felisiak a9e7beb959
Refs #33953 -- Fixed test_rename_model_with_db_table_rename_m2m() crash on SQLite < 3.20. 2022-08-29 10:07:53 +02:00
Mariusz Felisiak f210de760b
Refs #28333 -- Fixed NonQueryWindowTests.test_invalid_filter() on databases that don't support window expressions. 2022-08-29 09:14:56 +02:00
Mohamed Karam b92ffebb0c Fixed #33954 -- Prevented models.DecimalField from accepting NaN, Inf, and -Inf values. 2022-08-27 15:51:08 +02:00
David Wobrock 806e9e2d0d Fixed #33952 -- Reallowed creating reverse foreign key managers on unsaved instances.
Thanks Claude Paroz for the report.

Regression in 7ba6ebe914.
2022-08-27 15:03:48 +02:00
Simon Charette 0701bb8e1f Fixed #33928 -- Avoided unnecessary queries when cascade updating.
Models that use SET, SET_NULL, and SET_DEFAULT as on_delete handler
don't have to fetch objects for the sole purpose of passing them back to
a follow up UPDATE query filtered by the retrieved objects primary key.

This was achieved by flagging SET handlers as _lazy_ and having the
collector logic defer object collections until the last minute. This
should ensure that the rare cases where custom on_delete handlers are
defined remain uncalled when when dealing with an empty collection of
instances.

This reduces the number queries required to apply SET handlers from
2 to 1 where the remaining UPDATE use the same predicate as the non
removed SELECT query.

In a lot of ways this is similar to the fast-delete optimization that
was added in #18676 but for updates this time. The conditions only
happen to be simpler in this case because SET handlers are always
terminal. They never cascade to more deletes that can be combined.

Thanks Renan GEHAN for the report.
2022-08-27 14:25:55 +02:00
Iuri de Silvio 166a3b3263 Fixed #33953 -- Reverted "Fixed #33201 -- Made RenameModel operation a noop for models with db_table."
Regression in afeafd6036.
This reverts afeafd6036.

Thanks Timothy Thomas for the report.
2022-08-26 06:14:44 +02:00
Simon Charette 71902e0d9f Fixed #33938 -- Fixed migration crash for m2m with a through model in another app.
Regression in aa4acc164d.

Thanks bryangeplant for the report.
2022-08-25 10:03:57 +02:00
Neeraj Kumar 9942f3fb49 Fixed #33830 -- Fixed VariableDoesNotExist when rendering ClearableFileInput. 2022-08-25 07:52:36 +02:00
Willem Van Onsem 16fffc829c Fixed #33916 -- Added support for serialization of enum.Flag in migrations. 2022-08-25 06:43:48 +02:00
Simon Charette b30c0081d4 Refs #27412 -- Confirmed support for executing Coalesce(subquery).
This has been supported for subqueries wrapped in Subquery since the expression
was introduced and for Queryset directly since Subquery resolves to sql.Query.

Piggy-backed on the existing tests covering Coalesce handling of EmptyResultSet
as it seemed like a proper location to combine testing.
2022-08-24 12:30:47 +02:00
David Wobrock 897f38fabe Fixed #33927 -- Fixed crash when displaying ArrayField with choices in admin. 2022-08-23 15:51:42 +02:00
Claude Paroz 4488a25cc9 Removed unused path variable in model_fields tests. 2022-08-23 15:34:07 +02:00
Claude Paroz 903ac2f364 Fixed #33949 -- Fixed fixture dirs duplicates with Path instances. 2022-08-23 13:24:18 +02:00
Mariusz Felisiak e9fd2b5724
Refs #26511 -- Fixed json.KeyTextTransform() on MySQL/MariaDB. 2022-08-18 21:02:29 +02:00
Tom Carrick bd36023100 Used CSS flex for admin's submit row. 2022-08-18 12:29:40 +02:00
Benoît Vinot e3cb8bcb7d Fixed #33932 -- Fixed altering AutoFields to OneToOneField on PostgreSQL.
Regression in 2eea361eff.
2022-08-17 17:06:00 +02:00
Tom Carrick d46cc15c51 Fixed #33878 -- Switched to system fonts in CSS. 2022-08-17 10:19:00 +02:00
Willem Van Onsem 08688bd7dd Refs #33916 -- Added tests for serialization of enum.Flag in migrations. 2022-08-16 07:52:27 +02:00
Simon Charette 242499f2dc Fixed #26780 -- Added prefetch_related() support for sliced queries.
This was made possible by window function filtering support added in
f387d024fc.
2022-08-15 10:25:20 +02:00
Simon Charette f387d024fc Refs #28333 -- Added partial support for filtering against window functions.
Adds support for joint predicates against window annotations through
subquery wrapping while maintaining errors for disjointed filter
attempts.

The "qualify" wording was used to refer to predicates against window
annotations as it's the name of a specialized Snowflake extension to
SQL that is to window functions what HAVING is to aggregates.

While not complete the implementation should cover most of the common
use cases for filtering against window functions without requiring
the complex subquery pushdown and predicate re-aliasing machinery to
deal with disjointed predicates against columns, aggregates, and window
functions.

A complete disjointed filtering implementation should likely be
deferred until proper QUALIFY support lands or the ORM gains a proper
subquery pushdown interface.
2022-08-15 08:26:26 +02:00
Haolun Chai f3f9d03edf Fixed #33901 -- Skipped varchar_pattern_ops/text_pattern_ops index creation when db_collation is set. 2022-08-15 06:28:35 +02:00
Mariusz Felisiak 5c803bc070
Fixed #33919 -- Fixed adding AutoFields on PostgreSQL.
Thanks Jack Calvin Brown for the report.

Regression in 2eea361eff.
2022-08-12 17:30:23 +02:00
Claude Paroz 4fcba800b8 Fixed #33924 -- Deprecated BaseGeometryWidget.map_height/map_width attributes. 2022-08-12 13:26:35 +02:00
Carlton Gibson e34dfad0a3 Refs #30213 -- Removed post-startup check for Watchman availability.
This is checked at startup in get_reloader(). The runtime check ties
the implementation to Watchman excessively.
2022-08-11 11:02:03 +02:00
David Sanders e0ae1363ec Fixed #33905 -- Fixed CheckConstraint() validation on range fields.
Bug in 667105877e.
2022-08-09 20:13:21 +02:00
David Sanders e0ac72fe80 Refs #33905 -- Added test for CheckConstraint() validation with ArrayField and __contains. 2022-08-09 20:06:59 +02:00
David Wobrock 036bb2b74a Fixed #33895 -- Fixed Case() crash with filters that match everything in When().
Thanks shukryzablah for the report.
2022-08-09 07:55:31 +02:00
Mariusz Felisiak 63884829ac
Fixed #33902 -- Fixed Meta.constraints validation crash with F() expressions.
Thanks Adam Zahradník for the report.

Bug in 667105877e.
2022-08-09 06:08:48 +02:00
Kamil Turek e03cdf76e7 Fixed #31721 -- Allowed ModelForm meta to specify form fields. 2022-08-08 09:46:05 +02:00
Carlton Gibson 88e67a54b7 Added test for non-HTTP request on ASGIStaticFilesHandler. 2022-08-08 07:27:32 +02:00
Fiza Ashraf c0beff2123 Fixed #33899 -- Fixed migration crash when removing indexed field on SQLite 3.35.5+.
Regression in 702819227fd0cdd9b581cd99e11d1561d51cbeb.

Thanks cessor for the report.
2022-08-08 06:28:53 +02:00
Mariusz Felisiak fd93db97c7
Fixed #33898 -- Fixed Window() expression crash with ArrayAgg().
Thanks Kia for the report.

Regression in e06dc4571e.
2022-08-06 17:59:31 +02:00
Fab 0756c61f2a Fixed #33893 -- Reverted "Fixed #28889 -- Prevented double submission of admin forms."
Regression in fe7dbef586.
2022-08-05 16:38:52 +02:00
Carlton Gibson f476c8847a Refs #33173, Refs #33755 -- Fixed ResourceWarning from unclosed files in ASGI tests. 2022-08-04 10:00:36 +02:00
Claude Paroz 0638b4e23d Fixed #33888 -- Fixed get_select2_language() crash with no language activated.
Regression in 3079133c73.
2022-08-03 19:51:25 +02:00
Alberto Planas 4e13b40a76
Fixed #33887 -- Fixed test_fails_squash_migration_manual_porting() on final tags.
Regression in 7c318a8bdd.
2022-08-03 16:36:04 +02:00
Mariusz Felisiak cb791a2540
Fixed #33872 -- Deprecated django.contrib.postgres.fields.CIText/CICharField/CIEmailField/CITextField. 2022-08-03 11:42:51 +02:00
Carlton Gibson bd062445cf Fixed CVE-2022-36359 -- Escaped filename in Content-Disposition header.
Thanks to Motoyasu Saburi for the report.
2022-08-03 08:46:31 +02:00
Mariusz Felisiak 919e65b21e Updated translations from Transifex.
This also fixes related i18n tests.

Forwardport of a3bab93324 from stable/4.1.x.

Co-authored-by: Claude Paroz <claude@2xlibre.net>
2022-08-03 08:04:34 +02:00
Mariusz Felisiak ab1955a05e
Fixed #33881 -- Added support for database collations to ArrayField(Char/TextFields). 2022-08-02 11:44:26 +02:00
Carlton Gibson 89e695a69b Fixed #33876, Refs #32229 -- Made management forms render with div.html template.
Thanks to Claude Paroz for the report.
2022-08-02 10:30:09 +02:00
Claude Paroz 44c24bf028 Refs #25706 -- Removed inline CSS in the openlayers widget template. 2022-08-01 20:29:49 +02:00
Mariusz Felisiak c18861804f Fixed warnings per flake8 5.0.0. 2022-07-31 08:16:19 +02:00
Marcelo Galigniana 564437f767 Fixed #33726 -- Added skip-link to admin for keyboard navigation. 2022-07-28 11:52:48 +02:00
Nick Pope 9dff316be4 Refs #32948, Refs #32946 -- Used Q.create() internally for dynamic Q() objects.
Node.create() which has a compatible signature with Node.__init__()
takes in a single `children` argument rather than relying in unpacking
*args in Q.__init__() which calls Node.__init__().

In addition, we were often needing to unpack iterables into *args and
can instead pass a list direct to Node.create().
2022-07-27 10:06:24 +02:00
Nick Pope ddf0002bb7 Refs #32948 -- Renamed Node._new_instance() to Node.create().
Node._new_instance() was added in
6dd2b5468f to work around Q.__init__()
having an incompatible signature with Node.__init__().

It was intended as a hook that could be overridden if subclasses needed
to change the behaviour of instantiation of their specialised form of
Node. In practice this doesn't ever seem to have been used for this
purpose and there are very few calls to Node._new_instance() with other
code, e.g. Node.__deepcopy__() calling Node and overriding __class__ as
required.

Rename this to Node.create() to make it a more "official" piece of
private API that we can use to simplify a lot of other areas internally.

The docstring and nearby comment have been reworded to read more
clearly.
2022-07-27 10:06:24 +02:00
Nick Pope cc52e02c96 Refs #32948 -- Added more tests for django.utils.tree.Node.
The tests for creating new instances or copying instances of Node and
its subclasses didn't fully capture the behaviour of the implementation,
particularly around whether the `children` list or is contents were the
same as the source.
2022-07-27 07:58:29 +02:00
Nick Pope 769d7cce4a Used AND, OR, XOR constants instead of hard-coded values. 2022-07-27 07:55:09 +02:00
Mariusz Felisiak a1e9e9abc5 Refs #27236 -- Reverted "Refs #27236 -- Added generic mechanism to handle the deprecation of migration operations."
This reverts commit 41019e48bb.
2022-07-26 11:41:19 +02:00
Mariusz Felisiak c773d5794e Refs #27236 -- Reverted AlterIndexTogether deprecation.
This partly reverts a6385b382e.
2022-07-26 11:41:19 +02:00
Claude Paroz 7bdb682215
Fixed BasicExtractorTests.test_makemessages_find_files() test. 2022-07-26 07:23:45 +02:00
Claude Paroz 2d23a07817 Fixed #33866 -- Added pathlib.Path support to GDALRaster constructor. 2022-07-25 20:48:33 +02:00
Claude Paroz f2dd652245 Fixed #33863 -- Fixed JavaScriptCatalog with more than 1 level of fallback translations.
Co-authored-by: Carlos Mermingas <cmermingas@gmail.com>
2022-07-25 08:45:46 +02:00
Claude Paroz 3b79dab19a Refs #33691 -- Deprecated insecure password hashers.
SHA1PasswordHasher, UnsaltedSHA1PasswordHasher, and UnsaltedMD5PasswordHasher
are now deprecated.
2022-07-23 21:29:31 +02:00
Claude Paroz 0afb65e635
Removed unneeded test suite creation for GIS measure tests. 2022-07-23 15:57:05 +02:00
Nick Pope 4d4bf55e0e Fixed #33864 -- Deprecated length_is template filter. 2022-07-23 12:36:21 +02:00
Mariusz Felisiak f810325721
Refs #27236 -- Made cosmetic edits to Meta.index_together deprecation.
This should make it more straightforward to move forward when
deprecation ends.
2022-07-21 07:05:50 +02:00
Mariusz Felisiak 24effbceb8
Fixed #33855 -- Removed unnecessary system check calls from test worker initialization.
Regression in 3b3f38b3b0.
2022-07-19 09:45:11 +02:00
Jarrett Keifer 3e3e814166
Fixed #33854 -- Corrected the order of parameters in dbshell on PostgreSQL. 2022-07-18 06:30:20 +02:00
cheng d4c5d2b52c Fixed #33631 -- Marked {% blocktranslate asvar %} result as HTML safe. 2022-07-14 11:09:19 +02:00
David Wobrock a6385b382e
Fixed #27236 -- Deprecated Meta.index_together in favor of Meta.indexes.
This also deprecates AlterIndexTogether migration operation.
2022-07-12 09:04:31 +02:00
David Wobrock 4f284115a9 Refs #27236 -- Split RenameField() tests with unique/index_together. 2022-07-12 06:38:03 +02:00
David Wobrock f8f16b3cd8 Refs #27236 -- Removed usage of Meta.index_together from indexes/introspection test models. 2022-07-11 08:30:19 +02:00
Ikko Ashimine 77330a089c
Fixed typo in tests/sitemaps_tests/test_http.py. 2022-07-11 08:25:04 +02:00
Mariusz Felisiak eb3699ea77
Fixed #33718 -- Dropped support for MySQL 5.7. 2022-07-08 13:30:12 +02:00
Stéphane "Twidi" Angel ccbf714ebe Fixed #33829 -- Made BaseConstraint.deconstruct() and equality handle violation_error_message.
Regression in 667105877e.
2022-07-08 08:17:42 +02:00
David Wobrock 41019e48bb Refs #27236 -- Added generic mechanism to handle the deprecation of migration operations. 2022-07-08 07:05:55 +02:00
Christos Kopanos 608ab043f7 Fixed #33826 -- Fixed RedisCache.set_many()/delete_many() crash with an empty list. 2022-07-06 10:45:52 +02:00
Vladimir Kochetkov 3926e35aa8 Fixed #33823 -- Made inspectdb generate unique related_name when reverse accessor clashes. 2022-07-06 09:35:50 +02:00
Simon Charette 877c800f25 Refs CVE-2022-34265 -- Properly escaped Extract() and Trunc() parameters.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2022-07-06 07:40:07 +02:00
Mariusz Felisiak 73766c1187
Fixed RelatedGeoModelTest.test08_defer_only() on MySQL 8+ with MyISAM storage engine. 2022-07-05 19:05:03 +02:00
Shawn Dong 18c5ba07cc Fixed #33822 -- Fixed save() crash on model formsets when not created by modelformset_factory().
Thanks Claude Paroz for the report.

Regression in e87f57fdb8.
2022-07-05 07:19:18 +02:00
Mariusz Felisiak 249ecc437f
Fixed #33815 -- Fixed last_executed_query() on Oracle when parameter names overlap. 2022-07-05 05:53:49 +02:00
Mariusz Felisiak 54eb8a374d Fixed CVE-2022-34265 -- Protected Trunc(kind)/Extract(lookup_name) against SQL injection.
Thanks Takuto Yoshikai (Aeye Security Lab) for the report.
2022-07-04 08:13:41 +02:00
Ipakeev 425718726b
Fixed #33816 -- Fixed QuerySet.only() after select_related() crash on proxy models. 2022-07-04 06:37:36 +02:00
Mariusz Felisiak 863aa7541d
Fixed GEOSTest.test_emptyCollections() on GEOS 3.8.0.
It's a regression in GEOS 3.8.0 fixed in GEOS 3.8.1.
2022-07-01 19:05:27 +02:00
Michael Manfre 03eec9ff6c Updated vendored _urlsplit() to strip newline and tabs.
Refs Python CVE-2022-0391. Django is not affected, but others who
incorrectly use internal function url_has_allowed_host_and_scheme()
with unsanitized input could be at risk.
2022-07-01 08:48:38 +02:00
Hrushikesh Vaidya 72e41a0df6 Fixed #33779 -- Allowed customizing encoder class in django.utils.html.json_script(). 2022-06-28 10:54:38 +02:00
Mehrdad d4d5427571 Refs #33697 -- Used django.utils.http.parse_header_parameters() for parsing boundary streams.
This also removes unused parse_header() and _parse_header_params()
helpers in django.http.multipartparser.
2022-06-28 09:42:47 +02:00
Ankur eb7b8f3699 Fixed #33805 -- Made admin's many-to-many widgets do not display help text for selecting values when allow_multiple_selected is False. 2022-06-28 06:04:42 +02:00
Mariusz Felisiak 44ffd8d06f Fixed #33796 -- Fixed ordered combined queryset crash when used in subquery on PostgreSQL and MySQL.
Thanks Shai Berger for the report.

Regression in 30a0144134.
2022-06-27 06:21:31 +02:00
Mariusz Felisiak 083bfca6b6
Fixed #33800 -- Fixed system check for the same template tag module in installed apps and template tag libraries.
Thanks Claude Paroz for the report.

Regression in 004b4620f6.
2022-06-23 20:22:59 +02:00
DhruvaPatil98 c627226d05 Fixed #33799, Refs #31685 -- Added parameters for updating conflicts to QuerySeta.abulk_create(). 2022-06-23 11:12:35 +02:00
Florian Apolloner e6f36ea0a9 Made HashedFilesMixin ignore URLs without a path. 2022-06-23 08:59:49 +02:00
Marcelo Galigniana d80a258553 Fixed #33028 -- Used ModelAdmin's opts attribute instead of model._meta. 2022-06-22 07:50:24 +02:00
Claude Paroz de74a74b4b Fixed #33794 -- Fixed string-casting of GIS queries on PostgreSQL.
Regression in 64c3f049ea.
2022-06-21 10:10:37 +02:00
Abhinav Yadav 2887b9f67c
Fixed #33657 -- Allowed customizing formatter class of argument parsers. 2022-06-20 17:34:52 +02:00
Anv3sh d7f5bfd241 Fixed #32969 -- Fixed pickling HttpResponse and subclasses. 2022-06-20 08:51:26 +02:00
Zainab Amir 901a169198 Fixed #23689 -- Made parsing HTTP Accept-Language header case-insensitive.
Thank you Daniel Samuels for test project.
2022-06-20 07:40:28 +02:00
Matt Brewer 8d160f154f Fixed #33788 -- Added TrigramStrictWordSimilarity() and TrigramStrictWordDistance() on PostgreSQL. 2022-06-17 11:14:30 +02:00
David Wobrock 3ef37a5245 Fixed #28897 -- Fixed QuerySet.update() on querysets ordered by annotations. 2022-06-17 10:06:17 +02:00
David Wobrock f4680a112d Refs #28897 -- Added test for QuerySet.update() on querysets ordered by inline m2m annotation. 2022-06-17 10:06:12 +02:00
David Wobrock e286ce17ff Fixed #24870 -- Added --update option to makemigrations command. 2022-06-17 07:50:39 +02:00
Carlton Gibson 2a2bde52f3 Updated asgiref dependency for 4.1 release series. 2022-06-16 12:13:15 +02:00
Pablo Pissi d287294885 Fixed #33772 -- Added QuerySet.first()/last() error message on unordered queryset with aggregation. 2022-06-14 12:24:43 +02:00
David Wobrock db588d4f0e Refs #27236 -- Split index_together and unique_together autodetector tests. 2022-06-13 09:03:36 +02:00
David Wobrock 457cfd6f39 Refs #27236 -- Added test_autodetector.BaseAutodetectorTests. 2022-06-13 08:55:25 +02:00
Bruce Cutler de1c8320ce Fixed #33773 -- Made Index with multiple fields respect DEFAULT_INDEX_TABLESPACE.
Thanks to Simon Charette for locating where issue lay.
2022-06-13 07:21:46 +02:00
Ebram Shehata 4996eaa7b5
Made QuerySet.bulk_update() raise an error when batch_size is zero. 2022-06-13 06:25:25 +02:00
Jonas Lundberg e96320c917 Fixed #33755 -- Moved ASGI body-file cleanup into request class. 2022-06-09 11:11:45 +02:00
Ronnie van den Crommenacker c32858a8ce Fixed #33565 -- Improved locale format validation for the makemessages command. 2022-06-08 16:17:12 +02:00
Mariusz Felisiak aaf00450d2
Removed obsolete assertions in BooleanFieldTests.test_return_type().
Added in e9bbdb39de.
Obsolete since e9103402c0.
2022-06-03 21:28:46 +02:00
Adam Johnson 00639dbd6d Refs #33765 -- Added tests for trailing whitespace in JavaScript source map references. 2022-06-03 20:07:35 +02:00
Ciaran McCormick 286e7d076c Fixed #33764 -- Deprecated BaseUserManager.make_random_password(). 2022-06-03 07:30:57 +02:00
David Wobrock a3a1290d47 Refs #27236 -- Moved models with Meta.index_together inside of test methods. 2022-06-03 06:32:11 +02:00
Anders Kaseorg fbac2a4dd8 Fixed #33700 -- Skipped extra resolution for successful requests not ending with /.
By moving a should_redirect_with_slash call out of an if block, commit
9390da7fb6 negated the performance fix
of commit 434d309ef6 (#24720).
Meanwhile, the logging issue #26293 that it targeted was subsequently
fixed more fully by commit 40b69607c7
(#26504), so it is no longer needed.  This effectively reverts it.

This speeds up successful requests not ending with / when APPEND_SLASH
is enabled (the default, and still useful in projects with a mix of
URLs with and without trailing /).  The amount of speedup varies from
about 5% in a typical project to nearly 50% on a benchmark with many
routes.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2022-06-02 15:15:04 +02:00
David Wobrock 798b6c23ee
Fixed #31788 -- Fixed migration optimization after altering field to ManyToManyField.
This makes AddField() used for altering to ManyToManyField, dependent
on the prior RemoveField.
2022-06-02 12:10:27 +02:00
Samir Shah 6f73eb9d90 Fixed #33742 -- Added id to GeoJSON serializer. 2022-06-01 19:11:26 +02:00
Tim Graham 9a3b7e5e2b
Refs #32234 -- Removed hardcoded IntegerField in inspectdb test. 2022-06-01 19:10:38 +02:00
kshivakumar 46efd03d26 Fixed #33733 -- Preserved wrapper assignment for manager methods. 2022-06-01 10:44:34 +02:00
Mariusz Felisiak 0982cf2a01 Refs #33733 -- Added tests for attributes of manager methods. 2022-06-01 10:44:34 +02:00
Mehrdad 93cedc82f2 Refs #33697 -- Fixed multipart parsing of headers with double quotes and semicolons.
See 1ef0c0349e
2022-06-01 10:11:07 +02:00
Anv3sh 295249c901 Fixed #32234 -- Made inspectdb inform about composite primary keys. 2022-06-01 08:40:44 +02:00
Allen Jonathan David 1058fc7023 Fixed #33191 -- Avoided clearing cached reference when saving child after parent.
Thanks Barry Johnson for the report.
2022-05-31 10:19:54 +02:00
Jonas Lundberg f1e0fc645b Fixed #33754 -- Fixed crash with prematurely closed ASGI request body.
Regression in 441103a04d.
2022-05-31 08:38:00 +02:00
Claude Paroz 292f372768 Fixed #33748 -- Fixed date template filter crash with lazy format.
Regression in 659d2421c7.
2022-05-31 06:09:39 +02:00
Marcelo Galigniana 8c0886b068 Fixed #22078 -- Fixed crash of Feed with decorated methods. 2022-05-26 10:39:51 +02:00
Marcelo Galigniana 7e4656e4b2 Refs #22078 -- Added syndication test for feeds with static methods. 2022-05-26 09:08:34 +02:00
David Wobrock b949e40e8c Fixed #23740 -- Fixed removing unique_together constraint if exists primary key/unique constraint on the same field. 2022-05-26 08:33:07 +02:00
Aymeric Augustin 8cf4de206c Normalized decorator style for functools.wraps. 2022-05-25 10:58:48 +02:00
Aymeric Augustin aff649a3bd Normalized imports of functools.wraps.
@wraps is 10 times more common than @functools.wraps. Standardize to
the most common version.
2022-05-25 10:58:28 +02:00
Aymeric Augustin 6485894157 Renamed wrapped functions to wrapper.
All these functions are wrapping another function. They're the wrapper,
while the function they're wrapping is the wrapped.
2022-05-25 10:53:52 +02:00
Marcelo Galigniana 241fe59b74 Refs #22078 -- Added syndication test for feeds with callable objects. 2022-05-23 06:16:26 +02:00
Mariusz Felisiak 1733c888f4
Refs #33725 -- Replaced deprecated find_element_by_css_selector() with find_elements(By.CSS_SELECTOR, …).
Follow up to 90dcf27114 and
2ccc0b22db.
2022-05-23 06:06:37 +02:00
Sankalp 90dcf27114 Fixed #33725 -- Made hidden quick filter in admin's navigation sidebar not focusable.
Regression in d915dd1c58.

Follow up to 780473d756.
2022-05-21 13:37:53 +02:00
cheng 0dd2920909 Fixed #33653 -- Fixed template crash when calling methods for built-in types without required arguments.
Regression in 09341856ed.
2022-05-20 07:53:05 +02:00
Hasan Ramezani 1a78ef2b85
Fixed #33715 -- Allowed keyboard interrupt to abort queries in MySQL dbshell. 2022-05-20 07:11:51 +02:00
Mariusz Felisiak 41c4cb253c
Fixed #33719 -- Fixed test command crash when running in parallel.
Thanks Pēteris Caune for the report.

Regression in 3b3f38b3b0.
2022-05-19 10:20:51 +02:00
Mariusz Felisiak 981c23c0cc
Fixed #33717 -- Dropped support for PostgreSQL 11. 2022-05-19 09:26:48 +02:00
David Wobrock 9f55489529 Fixed #33705 -- Fixed crash when using IsNull() lookup in filters.
Thanks Florian Apolloner for the report.
Thanks Simon Charette for the review.
2022-05-19 07:02:22 +02:00
Mariusz Felisiak 19297de2fe
Fixed #33713 -- Dropped support for MariaDB 10.3. 2022-05-18 08:38:08 +02:00