Commit Graph

29766 Commits

Author SHA1 Message Date
Mads Jensen c51bf80d56 Used more specific unittest assertions in tests. 2021-07-07 10:51:38 +02:00
Claude Paroz 7309393c3a Documented in_bulk behavior with nonexistent id_list items.
Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
2021-07-07 10:13:32 +02:00
abhiabhi94 6a5ef557f8 Added test for errors when saving timezone-aware times if not supported. 2021-07-06 10:44:06 +02:00
Keryn Knight f35ab74752 Fixed #32892 -- Optimized django.utils.dateparse functions by using fromisoformat(). 2021-07-06 08:57:17 +02:00
Keryn Knight 857320e9e0 Added more tests for parse_time(). 2021-07-06 08:45:23 +02:00
Adam Johnson 14518ccf75
Bumped versions in pre-commit configuration. 2021-07-06 08:19:46 +02:00
Hannes Ljungberg a06b977a91 Fixed #32776 -- Added support for Array subqueries on PostgreSQL. 2021-07-06 07:36:52 +02:00
Mariusz Felisiak 49ca6bbc44
Fixed isolation of RouterTestCase.test_m2m_cross_database_protection().
Hardcoded pks are necessary for this test case, however we need to set
them for all new rows because the sequence will not increment
automatically. It works when the sequence is incremented by other
test cases.
2021-07-05 15:22:08 +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
Mariusz Felisiak 1ff0ea6e9b
Fixed isolation of test_filename_traversal_upload().
shutil.rmtree(MEDIA_ROOT) is already called as a class cleanup.
2021-07-05 12:05:13 +02:00
Wu Haotian aba9c2de66 Fixed #32226 -- Fixed JSON format of QuerySet.explain() on PostgreSQL. 2021-07-05 09:08:39 +02:00
Wu Haotian b3b04ad211 Refs #28574 -- Added test for XML format output to Queryset.explain(). 2021-07-05 09:01:54 +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
Mariusz Felisiak 8feb2a49fa Added CVE-2021-35042 to security archive. 2021-07-01 09:57:08 +02:00
Mariusz Felisiak bcea1a3193 Added stub release notes for Django 3.2.6. 2021-07-01 09:43:15 +02:00
Mariusz Felisiak dae83a2451 Forwardported release notes for CVE-2021-35042. 2021-07-01 09:42:54 +02:00
Daniele Procida 62988afbea Refs #32880 -- Renamed/reordered logging topic sections.
Moved sections so that how-to type material is all together, and
renamed headings so it's clearer what those sections are about, in
anticipation of creating a separate how-to document and expanding
the material.
2021-07-01 07:30:53 +02:00
Daniele Procida 261ca6ce2e Removed trailing whitespace in logging topic. 2021-07-01 07:12:56 +02:00
Mariusz Felisiak 8e97698d7b Added stub release notes for 3.1.13 and release date for 3.2.5. 2021-07-01 06:52:41 +02:00
Thomas Guettler 775f7506d7 Fixed #32850 -- Doc'd Sitemap.paginator. 2021-06-30 20:11:49 +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
Chris Jerdonek 43d1ea6e2f Refs #32885 -- Used _read_csrf_cookie()/_set_csrf_cookie() in more CSRF tests. 2021-06-30 07:48:15 +02:00
Chris Jerdonek abc8795632 Fixed #32885 -- Removed cookie-based token specific logic from CsrfViewMiddlewareTestMixin. 2021-06-30 07:48:15 +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
Mariusz Felisiak 5371ad1d14
Refs #26430 -- Added tests for PostgreSQL-specific aggregates on EmptyQuerySets and used subTest(). 2021-06-29 20:23:59 +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
Chris Jerdonek 594d6e9407 Refs #32843 -- Added CsrfViewMiddlewareTestMixin._get_csrf_cookie_request() hook. 2021-06-29 08:56:13 +02:00
Chris Jerdonek c8439d1dba Refs #32843 -- Added method/cookie arguments to CsrfViewMiddlewareTestMixin._get_request().
This also removes unnecessary test hooks.
2021-06-29 08:56:13 +02:00
Chris Jerdonek 6bccb64347 Refs #32843 -- Moved _get_GET_csrf_cookie_request() to CsrfViewMiddlewareTestMixin. 2021-06-29 08:56:05 +02:00
Chris Jerdonek 4397d2bd6b Fixed #32843 -- Ensured the CSRF tests' _get_GET_csrf_cookie_request() sets the request method. 2021-06-29 08:14:25 +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
Daniele Procida d79be3ed39 Refs #32880 -- Rearranged logging security notes.
Expanded security notes and moved them under a new explanation heading
of their own for future reference and expansion.

Removed specific reference to Sentry since there are multiple
third-party services that fulfill that role.
2021-06-28 11:46:37 +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
Nick Pope 66af94d56e Removed unnecessary json.loads() call in test_json_agg_empty(). 2021-06-28 09:22:23 +02:00
Nick Pope e8e8e207e7 Ensured that empty result test for JSONBAgg executes a query.
Use of QuerySet.none() will cause the EmptyQuerySet aggregation
optimisation to be used. Change the test to be implemented like the
other tests for empty results in this file.
2021-06-28 09:21:57 +02:00
Nick Pope 1aca9fc7d2 Corrected test method and variable names for JSONBAgg.
This is probably a hangover from when the aggregate function was
originally called JSONAgg during development.
2021-06-28 09:17:34 +02:00
Chris Jerdonek 5e60c3943b Refs #32800 -- Added CsrfViewMiddleware tests for all combinations of masked/unmasked cookies and tokens. 2021-06-28 08:31:30 +02:00
Chris Jerdonek defa8d3d87 Refs #32800 -- Made CsrfViewMiddlewareTestMixin._csrf_id_cookie and _csrf_id_token different.
This also renames CsrfViewMiddlewareTestMixin._csrf_id to _csrf_id_token.
2021-06-28 08:09:53 +02:00