Commit Graph

18206 Commits

Author SHA1 Message Date
Chenyang Yan 36d54b7a14 Fixed #33027 -- Made autoreloader pass -X options. 2021-09-29 11:37:50 +02:00
David Smith 4884a87e02 Fixed #33134 -- Fixed recursion depth error when rendering Form with BoundFields.
Regression in 456466d932.
2021-09-29 08:04:42 +02:00
Chinmoy Chakraborty b7fd668b37 Fixed #33033 -- Prevented models.DecimalField from accepting NaN values. 2021-09-28 13:20:14 +02:00
Jordan Bae f5a3243911 Fixed #33125 -- Avoided redundant unique constraint when converting a non-unique field to primary key on MySQL and PostgreSQL. 2021-09-28 06:20:37 +02:00
Claude Paroz 4ffada3609 Fixed #33136 -- Added GEOSGeometry.make_valid() method. 2021-09-27 09:58:28 +02:00
Mariusz Felisiak fb05ca420d
Used Path.read_text() in jinja2.get_exception_info(). 2021-09-27 09:55:02 +02:00
Mariusz Felisiak 5bac1719a2
Refs #32355 -- Used @functools.lru_cache as a straight decorator. 2021-09-27 09:10:58 +02:00
Adam Johnson 840ad06300 Refs #32355 -- Modernized subprocess.run() calls. 2021-09-27 08:20:24 +02:00
ali ca58378390 Fixed #33114 -- Defined default output_field of StringAgg.
Thanks Simon Charette for the review.
2021-09-27 06:58:54 +02:00
Keryn Knight 06c50cee0f Fixed #33124 -- Avoided accessing the database connections when not necessary.
Follow up to bf5abf1bdc.

This also caches the __getitem__ access.
2021-09-24 12:19:39 +02:00
Jaap Roes 7fe9b6f6df Fixed #33130 -- Restored form errors to be a dict.
Regression in 456466d932.
2021-09-24 10:50:41 +02:00
Jaap Roes b1bf8c8a4b Fixed #33132 -- Fixed test client handling of querystring only redirects.
Regression in 1e5aa8e1c7.
2021-09-24 08:22:28 +02:00
Hasan Ramezani f997c81472 Fixed #33127 -- Added error messages on | and & operators with combined querysets. 2021-09-24 06:59:22 +02:00
Carlton Gibson 25cbd1e6aa Refs #33129 -- Added missing return statement.
Thanks to Claude Paroz for spotting it.

Regression in 221b2f85fe.
2021-09-23 15:36:01 +02:00
Mariusz Felisiak 3b9fe906bf
Fixed #33133 -- Fixed handling NullBooleanField in historical migrations.
Regression in d992f4e3c2.
2021-09-23 10:36:30 +02:00
Nick Pope 448d974d96 Fixed #32499 -- Escaped additional metacharacters in simplify_regex(). 2021-09-22 11:59:59 +02:00
Nick Pope 85540da930 Refs #32499 -- Fixed escaped metacharacters in simplify_regex(). 2021-09-22 11:59:59 +02:00
Nick Pope 27189af8cf Refs #32499 -- Added metacharacters helper for simplify_regex(). 2021-09-22 11:59:59 +02:00
Mariusz Felisiak 221b2f85fe
Fixed #33129 -- Dropped support for MariaDB 10.2. 2021-09-22 11:57:54 +02:00
Illia Volochii bc4c7e5d68 Optimized handling case-insensitive mappings.
Elements yielded by _destruct_iterable_mapping_values are always
unpacked. Since unpacking can be done with any iterable, there is no
need to convert elements to tuples. Also, such elements can be used
directly in for loops, creating a dictionary of them is excessive.

Co-authored-by: Nick Pope <nick@nickpope.me.uk>
2021-09-22 09:26:21 +02:00
Carlton Gibson b0ed619303
Fixed #33083 -- Fixed selecting all items in the admin changelist when actions are both top and bottom.
Thanks Benjamin Locher for the report.

Regression in 30e59705fc.
2021-09-21 19:58:00 +02:00
Mariusz Felisiak 7d909b2282 Updated source translation catalogs.
Forwardport of 5b8cc4ce26 from stable/4.0.x.
2021-09-21 13:40:07 +02:00
Hasan Ramezani 2f0f30f973 Fixed #33111 -- Fixed passing object to ModelAdmin.get_inlines() when editing in admin change view.
ModelAdmin.get_inlines() should get an unmutated object when creating
formsets during POST request.
2021-09-21 13:12:09 +02:00
Mariusz Felisiak 1bb8200f2f
Refs #32204 -- Replaced three dots with ellipsis in navigation sidebar template. 2021-09-21 10:19:14 +02:00
Cleiton Lima 8eb5693091 Fixed #33070 -- Fixed loading translations with language subtags in admin's Select2 widget. 2021-09-21 07:18:37 +02:00
Mariusz Felisiak 32b7ffc2bb Increased the default PBKDF2 iterations for Django 4.1. 2021-09-20 21:23:01 +02:00
Mariusz Felisiak 8b6d0333cf Advanced deprecation warnings for Django 4.1. 2021-09-20 21:23:01 +02:00
Mariusz Felisiak 737fa72ae3 Refs #32191 -- Removed for the pre-Django 3.2 format of messages in CookieStorage.
Per deprecation timeline.
2021-09-20 21:23:01 +02:00
Mariusz Felisiak 05f3a6186e Refs #32193 -- Removed MemcachedCache per deprecation timeline. 2021-09-20 21:23:01 +02:00
Mariusz Felisiak e2be307b3a Refs #31235 -- Made assertQuerysetEqual() not call repr() on a queryset when compared to string values.
Per deprecation timeline.
2021-09-20 21:23:01 +02:00
Mariusz Felisiak 75d6c4ae6d Refs #31180 -- Removed default_app_config application configuration variable per deprecation timeline. 2021-09-20 21:23:01 +02:00
Mariusz Felisiak d25710a625 Refs #31670 -- Removed whitelist argument and domain_whitelist attribute in EmailValidator per deprecation timeline. 2021-09-20 21:23:01 +02:00
Mariusz Felisiak 1cb495074f Refs #31546 -- Removed support for boolean values in Command.requires_system_checks.
Per deprecation timeline.
2021-09-20 21:23:01 +02:00
Mariusz Felisiak 2e10abeb7f Refs #31395 -- Removed support for assigning objects which don't support deepcopy() in setUpTestData().
Per deprecation timeline.
2021-09-20 21:23:01 +02:00
Mariusz Felisiak a7dc745ee5 Bumped version; main is now 4.1 pre-alpha. 2021-09-20 21:23:01 +02:00
David Smith 456466d932 Fixed #31026 -- Switched form rendering to template engine.
Thanks Carlton Gibson, Keryn Knight, Mariusz Felisiak, and Nick Pope
for reviews.

Co-authored-by: Johannes Hoppe <info@johanneshoppe.com>
2021-09-20 15:50:18 +02:00
Keryn Knight 5353e7c250 Refs #27624 -- Optimized Query.clone() for non-combined queries.
This avoids constructing a generator expression and a new tuple if the
Query has no combined queries.
2021-09-20 12:34:18 +02:00
Keryn Knight e441847eca Fixed #32970 -- Changed WhereNode.clone() to create a shallow copy of children. 2021-09-20 07:03:10 +02:00
Mariusz Felisiak ef4ef3b8f5
Fixed #32504 -- Updated admin's jQuery to 3.6.0. 2021-09-20 06:54:35 +02:00
Ken Whitesell 0a9aa02e6f Fixed #33077 -- Fixed links to related models for admin's readonly fields in custom admin site. 2021-09-18 12:27:28 +02:00
Nikita Marchant 4e4082f939 Fixed #32492 -- Added TrigramWordSimilarity() and TrigramWordDistance() on PostgreSQL. 2021-09-17 13:05:15 +02:00
Giannis Adamopoulos 4555aa0a48 Fixed #27674 -- Deprecated GeoModelAdmin and OSMGeoAdmin.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-09-17 08:56:16 +02:00
Adam Johnson fc91ea1e50 Refs #27624 -- Changed Query.explain_info to namedtuple. 2021-09-17 07:15:12 +02:00
Adam Johnson 2931d847c2 Optimized Query.clone() a bit.
This removes unnecessary "if ... is None" branches, which are already
shallow-copied in the __dict__.copy() call.
2021-09-17 07:12:56 +02:00
Carlton Gibson 306607d5b9 Fixed #32365 -- Made zoneinfo the default timezone implementation.
Thanks to Adam Johnson, Aymeric Augustin, David Smith, Mariusz Felisiak, Nick
Pope, and Paul Ganssle for reviews.
2021-09-16 12:11:05 +02:00
Mariusz Felisiak 6426c3077c
Fixed #33107 -- Fixed import_string() crash on not fully initialized modules.
Regression in ecf87ad513.

Thanks Collin Anderson for the report.
2021-09-16 07:12:58 +02:00
Daniyal ec212c6616 Fixed #33012 -- Added Redis cache backend.
Thanks Carlton Gibson, Chris Jerdonek, David Smith, Keryn Knight,
Mariusz Felisiak, and Nick Pope for reviews and mentoring this
Google Summer of Code 2021 project.
2021-09-14 15:50:08 +02:00
Claude Paroz 676bd084f2 Fixed #32873 -- Deprecated settings.USE_L10N.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-09-14 12:05:43 +02:00
Aakash Singh 04e023e383
Fixed #33104 -- Fixed wrapping of long words in admin readonly fields. 2021-09-13 08:50:16 +02:00
yujin ecf87ad513 Fixed #33099 -- Improved performance of import_string().
This improves performance of import_string() by avoiding multiple
imports for the same path.

Thanks Andrew Godwin and Keryn Knight for the implementation idea.
2021-09-10 12:37:00 +02:00
antoinehumbert de95c82667 Fixed #31867 -- Made TabularInline handling of hidden fields with view-only permissions consistent with StackedInline. 2021-09-10 10:10:53 +02:00
Jan Schär 06e59d97a3 Fixed #33096 -- Fixed <form> nesting in technical 500 template.
This also prevents sending <form> tags in emails.
2021-09-10 06:44:39 +02:00
Hasan Ramezani 0a28b42b15 Fixed #33084 -- Removed incorrect system check for ManyToManyField with limit_choices_to. 2021-09-09 12:07:59 +02:00
Siburg 46c8df640c Fixed #32219 -- Made InlineModelAdmin.verbose_name_plural fallback to its verbose_name. 2021-09-08 13:20:13 +02:00
Mariusz Felisiak 4a43335d30
Fixed #30086, Refs #32873 -- Made floatformat template filter independent of USE_L10N. 2021-09-08 08:37:27 +02:00
Andrew-Chen-Wang 301a85a12f Fixed #32076 -- Added async methods to BaseCache.
This also makes DummyCache async-compatible.
2021-09-07 20:14:25 +02:00
Nick Pope 42dfa97e19 Fixed #33060 -- Added BaseCache.make_and_validate_key() hook.
This helper function reduces the amount of duplicated code and makes it
easier to ensure that we always validate the keys.
2021-09-07 11:59:59 +02:00
Nick Pope 4b82578a60 Refs #33060 -- Ensured cache backends validate keys.
The validate_key() function should be called after make_key() to ensure
that the validation is performed on the key that will actually be
stored in the cache.

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-09-07 11:59:40 +02:00
Peter Inglesby 3921b1c6d2 Refs #32363 -- Made shell ignore a missing sys.___interactivehook__.
Thanks Tim Graham for the report.

Follow up to 1bbb98d9a4.
2021-09-06 10:18:13 +02:00
Mateo Radman a7f27fca52 Refs #32508 -- Raised TypeError/ValueError instead of using "assert" in encode() methods of remaining password hashers. 2021-09-06 07:47:53 +02:00
Nick Pope 68b8eda788 Refs #33060 -- Added .make_key() in .touch() for dummy cache backend.
All cache operations should use make_key().
2021-09-03 10:36:14 +02:00
taulant 0e8be73812 Fixed #32975 -- Fixed admin system check for inlines with foreign keys to proxy models. 2021-09-03 06:48:32 +02:00
Daniyal Abbasi dca4c2ff76 Refs #33012 -- Moved PickleSerializer to django.core.serializers.base and added tests. 2021-09-02 11:24:55 +02:00
Stefanos I. Tsaklidis d0ea01af28 Fixed #33079 -- Fixed get_image_dimensions() on nonexistent images.
Thanks Nick Pope for the review.
2021-09-02 07:08:50 +02:00
David Wobrock 691486a5cf Fixed #33073 -- Fixed queryset crash with aggregation and empty/extra queryset annotation. 2021-09-01 20:59:16 +02:00
Mariusz Felisiak 338fc0e7f1 Fixed #33080 -- Preserved nullability of textual fields on Oracle.
Thanks Matt Hoskins for the report.
2021-09-01 20:54:12 +02:00
Alex Hayward eeed488a34 Fixed #32768 -- Added Vary header when redirecting to prefixed i18n pattern.
get_language_from_request() uses Accept-Language and/or Cookie to determine the
correct redirect. Upstream caches need the matching Vary header to cache the
result.
2021-09-01 14:02:37 +02:00
sage 84c7c4a477 Fixed #32309 -- Added --exclude option to startapp/startproject management commands. 2021-09-01 12:08:02 +02:00
Mariusz Felisiak 1eb3f500a4
Fixed #33057 -- Fixed recreation of foreign key constraints in m2m tables when altering type of referenced primary key on Oracle. 2021-08-31 13:43:10 +02:00
Jan Szoja b667ac24ea Fixed #25264 -- Allowed suppressing base command options in --help output.
This also suppresses -verbosity and --trackback options in the
runserver's help.
2021-08-31 11:04:02 +02:00
Mariusz Felisiak 93e06f2978
Refs #33061 -- Removed unnecessary BaseMemcachedCache.decr(). 2021-08-31 10:37:59 +02:00
Sondre Lillebø Gundersen 2c912c3488 Fixed #33061 -- Fixed handling nonexistent keys with negative deltas in incr()/decr() in memcached backends.
Thanks Chris Jerdonek for the review.
2021-08-31 07:34:53 +02:00
Jacob Walls 3219dd3388 Fixed #24900 -- Allowed migrating backward to squashed migrations. 2021-08-30 12:08:04 +02:00
Carlton Gibson cbba49971b Fixed #32992 -- Restored offset extraction for fixed offset timezones.
Regression in 10d1261984.
2021-08-30 10:12:46 +02:00
Eugene Morozov d89f976bdd Fixed #33054 -- Made TestCase.captureOnCommitCallbacks() capture callbacks recursively. 2021-08-30 07:06:22 +02:00
Mateo Radman 02bc7161ec Fixed #32900 -- Improved migrations questioner prompts. 2021-08-27 13:27:41 +02:00
Hasan Ramezani d1216e126f Fixed #33051 -- Fixed highlighting the current model in admin's sidebar with non-ASCII model names. 2021-08-27 07:31:05 +02:00
David Smith 5942ab5eb1 Refs #32338 -- Made RadioSelect/CheckboxSelectMultiple render in <div> tags.
This improves accessibility for screen reader users.
2021-08-27 06:14:01 +02:00
Mariusz Felisiak fa1d7ba5b9
Refs #29898 -- Changed fields in ProjectState's relation registry to dict. 2021-08-26 07:49:37 +02:00
Chris Jerdonek 55cf9e93b5 Refs #32919 -- Simplified Lexer.create_token() by reorganizing blocks. 2021-08-25 13:14:35 +02:00
Chris Jerdonek 7ff72b5909 Refs #32919 -- Added assertion for token start in Lexer.create_token().
This adds an assertion in the code path where the method would otherwise
return None, which isn't allowed.
2021-08-25 13:07:52 +02:00
Manav Agarwal 196a99da5d Refs #29898 -- Made ProjectState encapsulate alterations in relations registry.
Thanks Simon Charette and Chris Jerdonek for reviews.

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-08-25 09:12:01 +02:00
Chris Jerdonek b263f4b69d Fixed #32552 -- Added logger argument to DiscoverRunner. 2021-08-24 09:23:01 +02:00
Tim Graham 022d29c934
Refs #10929 -- Allowed NowUTC SQL customization for third-party backends. 2021-08-24 08:28:03 +02:00
Märt Häkkinen ed317e79e3 Fixed #33030 -- Fixed broken links to GDAL docs. 2021-08-23 06:22:07 +02:00
Manav Agarwal 3e6a3e8853 Refs #29898 -- Refactored out ProjectState.resolve_model_relations()/resolve_model_field_relations() hooks. 2021-08-20 13:45:21 +02:00
Matjaz Gregoric 518ce7a51f Fixed #33017 -- Fixed storage engine introspection on MySQL.
This also improves performance on MySQL instances with a large number
of databases, since querying the information_schema table can be very
slow
2021-08-20 11:05:21 +02:00
Matjaz Gregoric e9aa20e4e1 Optimized DatabaseSchemaEditor._field_should_be_indexed() on MySQL. 2021-08-20 10:30:02 +02:00
Keryn Knight bf5abf1bdc Fixed #33025 -- Avoided accessing the database connections in Query.build_lookup() when not necessary.
Of the built-in backends, only Oracle treats empty strings and nulls as
equal, so avoid testing the default connection backend for
interprets_empty_strings_as_nulls if it can be established from the
lookup that it wouldn't affect the lookup instance returned. This
improves performance a small amount for most lookups being built,
because accessing the connections requires touching the thread critical
`Local` which is an expensive operation.
2021-08-19 13:28:59 +02:00
Chris Jerdonek 7800596924 Fixed #33014 -- Made ProjectState raise exception when real_apps argument is not a set. 2021-08-19 10:18:51 +02:00
Mariusz Felisiak 36714be874 Refs #31621 -- Fixed handling --parallel option in test management command and runtests.py.
Regression in ae89daf46f.
Thanks Tim Graham for the report.
2021-08-19 09:18:32 +02:00
Matt Westcott 5092f7247d Fixed #33036 -- Made simple_tag()/inclusion_tag() with takes_context raise TemplateSyntaxError when function has no parameters. 2021-08-19 07:39:55 +02:00
Chris Jerdonek 231de683d8 Refs #32800 -- Added _add_new_csrf_cookie() helper function.
This centralizes the logic to use when setting a new cookie. It also
eliminates the need for the _get_new_csrf_token() function, which is now
removed.
2021-08-17 12:23:54 +02:00
Chris Jerdonek f10553ec93 Refs #32800 -- Renamed _set_token() to _set_csrf_cookie(). 2021-08-17 12:23:54 +02:00
Mariusz Felisiak 54a30a7a00 Refs #29898 -- Changed ProjectState.real_apps to set. 2021-08-11 09:01:14 +02:00
Mart Sõmermaa 9b1158a7e0 Fixed #32993 -- Added AutocompleteJsonView.serialize_result() to allow customization. 2021-08-10 07:44:37 +02:00
Mariusz Felisiak b64db05b9c
Removed unnecessary WhereNode.is_summary.
Unnecessary since its introduction in 1df89a60c5.
2021-08-09 19:23:29 +02:00
Chris Jerdonek f0776a558c Fixed #33002 -- Made DebugLexer.tokenize() more closely parallel Lexer.tokenize(). 2021-08-09 13:42:52 +02:00
Chris Jerdonek 6fedd868e1 Refs #33002 -- Renamed variable from bit to token_string in Lexer.tokenize(). 2021-08-09 13:42:52 +02:00
Chris Jerdonek 6242c22a2f Refs #33002 -- Optimized Lexer.tokenize() by skipping computing lineno when not needed. 2021-08-09 13:42:52 +02:00
Keryn Knight 921e4ccb77
Fixed #33003 -- Removed **kwargs from QuerySet._chain().
The functionality of updating the __dict__ was only present to allow
for pickling a Prefetch object, which is a comparably rare operation.
Forcing the __getstate__() implementation to handle it allows the
chaining operation to be slightly faster, which is much more common.
2021-08-09 13:28:40 +02:00
Premkumar Chalmeti fffeb5df55
Removed redundant definition of UserModel in ModelBackend.with_perm(). 2021-08-09 10:36:55 +02:00
Greg Twohig fc2bd40fc7 Fixed #32990 -- Simplified and optimized tag regex.
Thanks Chris Jerdonek for the review.
2021-08-09 08:21:43 +02:00
David Smith 8208381ba6 Refs #32956 -- Corrected spelling of daylight saving time.
AP Stylebook: Saving not savings, no hyphen, and lowercase.
2021-08-06 13:00:24 +02:00
qimingmafan ee46722cb9 Fixed typo in regex for IPv6 literals in EmailValidator. 2021-08-06 12:58:55 +02:00
Nick Touran 5d4f21b16f Fixed #32983 -- Added system check for redundant related_name on symmetrical M2M fields.
Since ManyToManyFields defined with `symmetrical=True` do not add a
related field to the target model, including a `related_name` argument
will never do what the coder likely expects. This makes including
a related_name with a symmetrical model raise a system check warning.

ticket-32983
2021-08-06 11:57:02 +02:00
Jarosław Wygoda d3c4696596 Fixed #27590 -- Allowed customizing a manifest file storage in ManifestFilesMixin. 2021-08-05 12:40:34 +02:00
Chris Jerdonek 4fe3774c72 Refs #32986 -- Moved TRANSLATOR_COMMENT_MARK to django.utils.translation.template. 2021-08-05 06:11:40 +02:00
Chris Jerdonek e79ae5c317 Fixed #32986 -- Removed unneeded str.find() call in Lexer.create_token().
Unnecessary since 47ddd6a408.
2021-08-05 05:57:36 +02:00
Mariusz Felisiak ab16507f19
Fixed #32988 -- Prevented creation of more test databases than TestCases.
DiscoverRunner.parallel is used in setup_databases() and
teardown_databases() to control the number of test databases.

Regression in cb6c19749d.
2021-08-05 05:55:35 +02:00
Jacob Walls 2d0ae8da80 Fixed #29205 -- Corrected rendering of required attributes for MultiValueField subfields. 2021-08-04 17:37:04 +02:00
Jacob Rief db1fc5cd3c Fixed #32855 -- Corrected BoundWidget.id_for_label() with custom auto_id. 2021-08-04 15:18:00 +02:00
Jacob Walls 910ecd1b8d Fixed #29063 -- Fixed migrate crash when specifying a name of partially applied squashed migrations. 2021-08-04 09:57:32 +02:00
Jacob Walls 202d3e193a Fixed typos in migrations tests, comments, and error message. 2021-08-04 09:28:23 +02:00
Ties Jan Hefting 4f3acf9579 Fixed #32984 -- Allowed customizing a deletion field widget in formsets. 2021-08-03 13:12:50 +02:00
Adam Johnson ae89daf46f Fixed #31621 -- Added support for '--parallel auto' to test management command. 2021-08-03 09:57:04 +02:00
Chris Jerdonek 7132341255 Refs #32800 -- Renamed _compare_masked_tokens() to _does_token_match(). 2021-08-03 07:10:31 +02:00
Keryn Knight edf184dd06 Fixed #32919 -- Optimized lexing & parsing of templates.
This optimizes:
- Lexer.create_token() by avoiding startswith() calls,
- Parser.parse() by re-using the token type enum's value,
- Parser.extend_nodelist() by removing unnecessary isinstance() check,
- some Node subclasses by removing the implicit "nodelist" from
  "child_nodelists",
- Variable.__init__() by avoiding startswith() calls.
2021-08-02 10:57:51 +01:00
Illia Volochii f03ba0ad52
Simplified serializing HTTP response headers.
Since ResponseHeaders was introduced, header names and values are stored
as strings. There is no need to check whether they are bytes.

Co-authored-by: Nick Pope <nick@nickpope.me.uk>
2021-08-02 09:24:48 +02:00
David Smith f9b7704ab3
Refs #32956 -- Corrected spelling of "gray". 2021-08-02 07:51:24 +02:00
David Smith 6802ac4415
Refs #32956 -- Corrected usage of "insure" and "assure". 2021-08-02 07:45:26 +02:00
David Smith fbb1984046
Refs #32956 -- Updated words ending in -wards.
AP styleguide: Virtually none of the words ending with -wards end with
an s.
2021-07-30 20:34:50 +02:00
Chris Jerdonek 6f5e07a84d Refs #32966 -- Refactored out DateTimeCheckMixin._check_if_value_fixed(). 2021-07-30 10:15:43 +02:00
Chris Jerdonek 6fa5d05dba Refs #32966 -- Simplified the _check_fix_default_value() implementations. 2021-07-30 09:31:29 +02:00
Chris Jerdonek eebebfe0a9 Refs #32966 -- Added _to_naive() and _get_naive_now() for use in DateTimeCheckMixin classes. 2021-07-30 09:31:24 +02:00
Chris Jerdonek 542e749475 Fixed #32966 -- Fixed TimeField.check() crash for timezone-aware times in default when USE_TZ = True. 2021-07-30 09:15:39 +02:00
Chris Jerdonek 7c30bdbdb1 Refs #32916 -- Replaced request.csrf_cookie_needs_reset with request.META['CSRF_COOKIE_NEEDS_UPDATE']. 2021-07-29 11:55:36 +02:00
Chris Jerdonek 6ebf931de8 Fixed #32916 -- Combined request.META['CSRF_COOKIE_USED'] and request.csrf_cookie_needs_reset. 2021-07-29 11:55:36 +02:00
Jonathan Davis 4c6a6d5ac7
Fixed #23895 -- Prevented pickling of ResolverMatch.
Pickling a ResolverMatch did not work correctly in many cases,
especially with CBVs and URLResolvers in the list of tried URL paths.
2021-07-29 07:04:56 +02:00
David Smith 1024b5e74a Fixed 32956 -- Lowercased spelling of "web" and "web framework" where appropriate. 2021-07-29 06:24:12 +02:00
Keryn Knight 9662193aea Refs #32946 -- Changed internal usage of dynamic Q() objects construction to use non-kwargs initialization.
This prefers non-kwargs construction of dynamically generated Q()
objects to create a single Q() object instead of many and then
combining them, where possible.
2021-07-28 09:38:46 +02:00
Keryn Knight 5b8ef8aa5b Refs #32946 -- Changed Query.add_filter() to take two arguments. 2021-07-28 09:38:42 +02:00
Chris Jerdonek 5fee36973c
Optimized BaseDatabaseSchemaEditor._effective_default() a bit,
This eliminates an unneeded call to datetime.now() when
field.get_internal_type() equals "DateTimeField".
2021-07-28 08:12:01 +02:00
Chris Jerdonek fe074c96a3 Refs #32962 -- Simplified NULL logic in BaseDatabaseSchemaEditor._iter_column_sql(). 2021-07-27 20:10:25 +02:00
Chris Jerdonek 809c45ea3c Fixed #32962 -- Consolidated string concatenations in BaseDatabaseSchemaEditor.column_sql(). 2021-07-27 20:10:20 +02:00
David Smith 1cba320786
Refs #32956 -- Changed "afterwards" to "afterward" in docs and comments.
This also removes unnecessary comments with the previous spelling.

AP Stylebook has a short entry to advise the preferred spelling for
"en-us". "Afterwards" is preferred in British English.
2021-07-27 10:41:51 +02:00
Jordan Bae 3d9040a50b Refs #32743 -- Fixed recreation of foreign key constraints when altering type of referenced primary key with MTI.
Follow up to 325d7710ce.
2021-07-27 07:30:33 +02:00
David Wobrock 325d7710ce Fixed #32743 -- Added foreign key altering when altering type of referenced primary key with MTI. 2021-07-26 08:51:56 +02:00
Tom Wojcik 20226fcd46 Fixed #32947 -- Fixed hash() crash on reverse M2M relation when through_fields is a list.
Regression in c32d8f33d8.
2021-07-26 06:09:29 +02:00
Virtosu Bogdan 00ea883ef5 Fixed #32329 -- Made CsrfViewMiddleware catch more specific UnreadablePostError.
Thanks Chris Jerdonek for the review.
2021-07-23 13:10:41 +02:00
Chris Jerdonek a2e1f1e295 Fixed #32902 -- Fixed CsrfViewMiddleware.process_response()'s cookie reset logic.
Thanks Florian Apolloner and Shai Berger for reviews.
2021-07-23 07:08:45 +02:00
ryowright 1783b3cb24 Fixed #32275 -- Added scrypt password hasher.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-07-22 12:40:33 +02:00
Wu Haotian 65b880b726 Fixed #32930 -- Fixed URLValidator when port numbers < 10. 2021-07-22 11:58:28 +02:00
Mariusz Felisiak 83022d279c
Refs #32508 -- Raised TypeError/ValueError instead of using "assert" in encode() methods of some password hashers. 2021-07-22 09:42:07 +02:00
Nick Pope c35b81b864 Fixed #32951 -- Removed Query.where_class & co.
Unused since 3caf957ed5.
2021-07-22 08:49:20 +02:00
yakimka c542d0a072 Fixed #32949 -- Restored invalid number handling in DecimalField.validate().
DecimalField must itself validate() values, such as NaN, which cannot be
passed to validators, such as MaxValueValidator, during the
run_validators() phase.

Regression in cc3d24d7d5.
2021-07-21 10:20:24 +02:00
David Wobrock fd999318ad Fixed #32704 -- Fixed list of deferred fields when chaining QuerySet.defer() after only(). 2021-07-20 12:15:29 +02:00
Keryn Knight 6a970a8b46
Fixed #32944 -- Avoided unnecessary WhereNode.add() calls.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-07-20 11:59:21 +02:00
Keryn Knight ff661dbd50 Refs #32940 -- Removed unnecessary branch in Node.add().
The "data in self.children" branch was causing data.__eq__ to be
called for each entries in "self.children" which resulted in a huge
slowdown during queryset construction.

It's purpose was to prevent queries of the form
    Model.objects.filter(foo='bar').filter(foo='bar')
from resulting in
    WHERE foo='bar' AND foo='bar'
but it's not covered by the suite and has arguable performance benefits
since it's not very common and SQL engines are usually very good at
folding/optimizing these.

See also #32632 for prior discussion around comparing data to the
Node's children.

Co-authored-by: Nick Pope <nick@nickpope.me.uk>
2021-07-20 07:19:28 +02:00
Keryn Knight fb35e0a2fe Refs #32940 -- Removed Node.add()'s unused squash parameter.
Unused since its introduction in d3f00bd570.

Co-authored-by: Nick Pope <nick@nickpope.me.uk>
2021-07-20 07:19:28 +02:00
Nick Pope fee8734596 Refs #10929 -- Deprecated forced empty result value for PostgreSQL aggregates.
This deprecates forcing a return value for ArrayAgg, JSONBAgg, and
StringAgg when there are no rows in the query. Now that we have a
``default`` argument for aggregates, we want to revert to returning the
default of ``None`` which most aggregate functions return and leave it
up to the user to decide what they want to be returned by default.
2021-07-19 13:41:16 +02:00
Nick Pope 501a8db465 Fixed #10929 -- Added default argument to aggregates.
Thanks to Simon Charette and Adam Johnson for the reviews.
2021-07-19 13:04:27 +02:00
Keryn Knight 59942a66ce Fixed #32941 -- Removed get_format_modules()'s unused reverse argument.
Unused since 0d8b523422.
2021-07-19 11:42:20 +02:00
Nick Pope e21daa4e4c
Removed unnecessary tuple construction in Node.__eq__(). 2021-07-19 06:38:35 +02:00
Jacob Walls 56f9579105 Fixed #32655 -- Deprecated extra_tests argument for DiscoverRunner.build_suite()/run_tests(). 2021-07-16 20:46:41 +02:00
Chris Jerdonek 0dc25526d8 Fixed #32924 -- Changed BaseForm.get_initial_for_field() to remove microseconds when needed. 2021-07-16 15:51:20 +02:00
Nick Pope 304f6ff46a
Prevented SQLCompiler.execute_sql() from closing cursor twice.
cursor_iter() helper calls cursor.close() in a finally block.
2021-07-16 13:11:46 +02:00
David Smith f51a792c41
Fixed #32928 -- Confirmed support for GDAL 3.3. 2021-07-16 09:36:53 +02:00
Mariusz Felisiak a56531ab1b
Fixed #32910 -- Unified different plural equations for the same language in contrib apps.
Thanks Martin Svoboda for the report and initial patch.
2021-07-15 20:42:17 +02:00
pochangl f6d3557aa1
Fixed #32929 -- Fixed handling query strings in AsyncRequestFactory. 2021-07-15 13:09:29 +02:00
Daniyal f479df7f8d Refs #32508 -- Raised Type/ValueError instead of using "assert" in django.db.models.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-07-15 11:43:33 +02:00
Chris Jerdonek 08f0778885 Refs #32920 -- Added BoundField._has_changed() for use in BaseForm.changed_data(). 2021-07-15 10:47:02 +02:00
Chris Jerdonek 90a33ab2ce Fixed #32920 -- Changed BaseForm to access its values through bound fields. 2021-07-15 10:47:02 +02:00
Ties Jan Hefting 84400d2e9d Fixed #32905 -- Added CSS class for non-form errors of formsets. 2021-07-15 07:00:39 +02:00
Carlton Gibson 3a45fea083 Fixed #21936 -- Allowed DeleteView to work with custom Forms and SuccessMessageMixin.
Thanks to Mariusz Felisiak for review.

Co-authored-by: Demetris Stavrou <demestav@gmail.com>
Co-authored-by: Caroline Simpson <github@hoojiboo.com>
2021-07-14 09:47:03 +02:00
Nick Pope 1f4908b01a Simplified django.utils.dateformat methods.
This removes unnecessary format('O') call, remove unnecessary method
calls for simple cases in TimeFormat, and simplifies time zone handling
in TimeFormat.
2021-07-13 13:27:01 +02:00
Chris Jerdonek 4be58fcc36
Fixed #32917 -- Added BaseForm._widget_data_value()/_field_data_value(). 2021-07-13 06:32:46 +02:00
Wilhelm Klopp bbf93efa19
Refs #23359 -- Corrected showmigrations help text for the --database option. 2021-07-13 06:29:21 +02:00
Mariusz Felisiak 0250340e37
Refs #32074 -- Used Enum.repr() format proposed for Python 3.10.
The Python's Steering Council decided to revert changes in the Enum
module (see https://bugs.python.org/issue44559) and moved them to
Python 3.11.

Follow up to 5d9b065d3f.

Thanks Nick Pope for the review.
2021-07-12 11:46:37 +02:00
Chris Jerdonek 5848b3a1d7 Fixed #32914 -- Prevented test --shuffle from skipping test methods.
"test --shuffle" skipped test methods when test classes were mixed.
This changes runner.py's reorder_tests() to group by TestCase class.

Regression in 90ba716bf0.
2021-07-12 06:36:12 +02:00
Ian Foote f42ccdd835 Fixed #27021 -- Allowed lookup expressions in annotations, aggregations, and QuerySet.filter().
Thanks Hannes Ljungberg and Simon Charette for reviews.

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-07-09 11:43:06 +02:00
Chris Jerdonek f5dccbafb9
Refs #24522 -- Fixed code comment about seeds in Shuffler.__init__(). 2021-07-09 08:20:16 +02:00
Chris Jerdonek 90ba716bf0 Fixed #24522 -- Added a --shuffle option to DiscoverRunner. 2021-07-08 07:29:04 +02:00
Mariusz Felisiak 77b88fe621
Fixed #32908 -- Allowed select_for_update(skip_locked) on MariaDB 10.6+. 2021-07-08 06:51:10 +02:00
Keryn Knight 5013798fe9
Fixed #32840 -- Optimized Field.get_col().
get_col() used "self" as "output_field" when it was not given, and
unnecessarily compared "self" to "self".

Co-authored-by: Chris Jerdonek <chris.jerdonek@gmail.com>
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-07-07 20:32:57 +02:00
Mariusz Felisiak 355ecd1416
Fixed inspectdb and schema tests on MariaDB 10.6+.
The utf8 character set (and related collations) is by default an alias
for utf8mb3 on MariaDB 10.6+.
2021-07-07 17:02:20 +02:00
abhiabhi94 cf6774a53b Fixed #32904 -- Made parse_time() more strict.
Thanks Keryn Knight for the report.
2021-07-07 12:08:43 +02:00
Shipeng Feng 68cc04887b
Fixed #32866 -- Fixed trimming trailing punctuation from escaped string in urlize(). 2021-07-07 11:19:33 +02:00
Keryn Knight f35ab74752 Fixed #32892 -- Optimized django.utils.dateparse functions by using fromisoformat(). 2021-07-06 08:57:17 +02:00
Hannes Ljungberg a06b977a91 Fixed #32776 -- Added support for Array subqueries on PostgreSQL. 2021-07-06 07:36:52 +02:00
Chris Jerdonek edde2a0699
Fixed #32901 -- Optimized BaseForm.__getitem__(). 2021-07-05 15:21:23 +02:00
Mateo Radman 2231429991 Refs #32508 -- Raised ImproperlyConfigured/TypeError instead of using "assert". 2021-07-05 13:31:03 +02:00
Wu Haotian aba9c2de66 Fixed #32226 -- Fixed JSON format of QuerySet.explain() on PostgreSQL. 2021-07-05 09:08:39 +02:00
Eduardo Aldair Ahumada Garcia Jurado e4da365436 Refs #24121 -- Added __repr__() to AdminSite, DefaultAdminSite, and ModelAdmin.
Thanks tlebrize for the initial patch.
2021-07-05 08:15:58 +02:00
Nick Pope fa35c8bdbc
Fixed #30934 -- Included database alias in django.db.backends log messages.
This is useful when working with database routing as you want to know
where each query is being executed.

Co-authored-by: David Winterbottom <david.winterbottom@gmail.com>
2021-07-02 15:36:53 +02:00
cammil 313c3d1aa1 Fixed #28935 -- Fixed display of errors in extended blocks.
Get the template that caused the exception and get the
exception info from that template, using the node that
caused the exception.
2021-07-02 11:38:15 +02:00
Simon Charette 9f3cce172f Refs #26430 -- Re-introduced empty aggregation optimization.
The introduction of the Expression.empty_aggregate_value interface
allows the compilation stage to enable the EmptyResultSet optimization
if all the aggregates expressions implement it.

This also removes unnecessary RegrCount/Count.convert_value() methods.
Disabling the empty result set aggregation optimization when it wasn't
appropriate prevented None returned for a Count aggregation value.

Thanks Nick Pope for the review.
2021-07-02 07:25:42 +02:00
Simon Charette f3112fde98 Fixed #26430 -- Fixed coalesced aggregation of empty result sets.
Disable the EmptyResultSet optimization when performing aggregation as
it might interfere with coalescence.
2021-07-02 06:40:54 +02:00
abhiabhi94 fde6fb2898 Fixed #32893 -- Fixed serialization of models.Model class in migrations.
Migrations assumed that an import of the models.Model class must
already be included when it's serialized, but for models with only
custom fields this was not necessarily the case.

Thanks Jaap Joris Vens for the report.
2021-07-01 12:42:32 +02:00
Allan Feldman 36fa071d6e Fixed #32889 -- Allowed per-request sync_to_async context in ASGIHandler .
By using a asgiref's ThreadSensitiveContext context manager, requests
will be able to execute independently of other requests when sync work
is involved.

Prior to this commit, a single global thread was used to execute any
sync work independent of the request from which that work was scheduled.
This could result in contention for the global sync thread in the case
of a slow sync function.

Requests are now isolated to their own sync thread.
2021-07-01 12:13:19 +02:00
Carlton Gibson 4af162d4de Refs #32144 -- Made makemessages remove temporary files on preprocessing error.
Co-authored-by: Anders Hovmöller <anders.hovmoller@dryft.se>
2021-07-01 10:11:10 +02:00
Carlton Gibson dfa7781033 Fixed #32144 -- Made makemessages remove temporary files when locale path doesn't exist. 2021-07-01 10:11:10 +02:00
Hannes Ljungberg d8c90d4c22 Fixed #32786 -- Moved subquery ordering clearing optimization to the _in lookup.
Co-Authored-By: Simon Charette <charette.s@gmail.com>
2021-06-30 10:08:55 +02:00
Hannes Ljungberg 053141d31f Refs #32786 -- Made Query.clear_ordering() not to cause side effects by default. 2021-06-30 08:52:27 +02:00
Daniele Procida e3d55eeb14 Refs #32880 -- Moved logging reference to new document.
Completed a first step in moving reference and how-to material out of
the topic document.
2021-06-30 07:21:52 +02:00
Chris Jerdonek 8bca838f4a Refs #32655 -- Improved error if iter_test_cases() is passed a string. 2021-06-29 20:41:40 +02:00
manav014 503ee41497 Refs #29898 -- Moved state_forwards()'s logic from migration operations to ProjectState.
Thanks Simon Charette and Markus Holtermann for reviews.
2021-06-29 12:03:30 +02:00
Lou Huang 7ba9da815d
Fixed #32884 -- Fixed centering of the header on admin login page. 2021-06-29 07:41:52 +02:00
abhiabhi94 cd124295d8 Fixed #32381 -- Made QuerySet.bulk_update() return the number of objects updated.
Co-authored-by: Diego Lima <diego.lima@lais.huol.ufrn.br>
2021-06-29 06:58:46 +02:00
Dan Strokirk f5ea9aa2f3 Fixed #32807 -- Fixed JSONField crash when redisplaying None values.
Thanks to Alex Hill for the initial patch.
2021-06-28 11:02:08 +02:00