Commit Graph

29733 Commits

Author SHA1 Message Date
William Schwartz 9ee693bd6c Fixed #32316 -- Deferred accessing __file__.
Deferred accessing the module-global variable __file__ because the
Python import API does not guarantee it always exists—in particular, it
does not exist in certain "frozen" environments. The following changes
advanced this goal.

Thanks to Carlton Gibson, Tom Forbes, Mariusz Felisiak, and Shreyas
Ravi for review and feedback.
2021-04-01 14:33:30 +02:00
Mariusz Felisiak cfe47b7686
Fixed #32610 -- Fixed get_git_changeset() on Linux.
shell=True is required on Windows. Unfortunately passing a sequence to
subprocess.run() behaves differently on Linux, i.e. the first item
specifies the command string, and any additional items are treated as
additional arguments to the shell itself.

https://docs.python.org/3.9/library/subprocess.html#subprocess.Popen
https://docs.python.org/3.9/library/subprocess.html#converting-an-argument-sequence-to-a-string-on-windows

Regression in a44d80f88e.
2021-04-01 11:11:07 +02:00
Mariusz Felisiak 548dce50cf
Removed unnecessary left/right in admin sidebar CSS. 2021-03-31 20:34:15 +02:00
Hugo Cachitas f83214a3e1 Refs #32594 -- Added Signal.disconnect() test with a model class.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-03-31 11:01:48 +02:00
Maxim Milovanov d915dd1c58 Fixed #32204 -- Added quick filter to admin's navigation sidebar. 2021-03-31 09:31:37 +02:00
William Schwartz 7248afe12f Refs #32105 -- Moved ExceptionReporter template paths to properties.
Refs #32316.
2021-03-31 08:41:57 +02:00
bankc db5b75f10f Fixed #31840 -- Added support for Cross-Origin Opener Policy header.
Thanks Adam Johnson and Tim Graham for the reviews.

Co-authored-by: Tim Graham <timograham@gmail.com>
2021-03-30 19:59:24 +02:00
Mariusz Felisiak f6018c1e63 Fixed #32595 -- Fixed SchemaEditor.quote_value() crash with bytes. 2021-03-30 11:42:15 +02:00
Mariusz Felisiak 3c75f1f3ca Refs #32595 -- Added MySQL's SchemaEditor.quote_value() tests for values with Unicode chars. 2021-03-30 11:42:15 +02:00
Chris Jerdonek 038940cf55 Fixed #29127 -- Prevented DiscoverRunner from hiding tagged test with syntax errors.
This mades _FailedTest objects always match tags in DiscoverRunner.
2021-03-30 10:26:20 +02:00
Daniyal 7c08f26bf0 Fixed #32260 -- Made View.as_view() do not use update_wrapper().
View.as_view() should not use update_wrapper() for copying attributes
it's unintended and have side-effects such as adding `self` to the
signature.

This also fixes system check for arguments of custom error handler
views with class-based views.

Co-authored-by: Nick Pope <nick.pope@flightdataservices.com>
2021-03-30 07:58:09 +02:00
Adam Johnson 0c0b87725b Refs #32260 -- Made admindocs and technical 404 debug page use view_func.view_class.
Internals of admindocs and technical 404 debug page should use the
view_class attribute and do not rely on __name__.
2021-03-30 06:51:27 +02:00
arcanemachine 4a80d0f220 Removed dead link in docs/topics/http/sessions.txt. 2021-03-30 06:08:22 +02:00
Nick Pope 41850eec99 Fixed #32572 -- Improved ResolverMatch.__repr__().
When a partial function was passed as the view, the __repr__() would
show the `func` argument as `functools.partial` which isn't very
helpful, especially as it doesn't reveal the underlying function or
arguments provided.
2021-03-29 11:28:56 +02:00
Nick Pope 2f13c476ab Fixed #31487 -- Added precision argument to Round(). 2021-03-29 09:43:08 +02:00
Chris Jerdonek 61d5e57353
Simplified and optimized test_match_tags().
This simplifies and optimizes runner.py's test_match_tags() because it
(1) uses isdisjoint() instead of intersection(), which involves
constructing a new set, (2) eliminates a set operation when tags is
falsey, (3) eliminates the need for a matched_tags variable, and (4)
uses fewer not's, which should make it easier to parse and understand.
2021-03-29 09:21:20 +02:00
Hasan Ramezani ed0cc52dc3 Fixed #32585 -- Fixed Value() crash with DecimalField on SQLite. 2021-03-29 06:22:36 +02:00
Chris Jerdonek dcb06c2c68 Fixed #32591 -- Made DiscoverRunner order _FailedTest objects first.
Failures detected when loading tests are ordered before all of the
above for quicker feedback. This includes things like test modules that
couldn't be found or that couldn't be loaded due to syntax errors.
2021-03-26 12:18:27 +01:00
William Schwartz cecdec91cf Refs #32355 -- Corrected comments about Python's _NamespacePath.
_NamespacePath supports indexing in Python 3.8+.
2021-03-26 10:17:10 +01:00
John 509d266c6a
Added missing mode="rb" argument to open() call in Client.post() example in docs. 2021-03-26 08:04:59 +01:00
sreehari1997 0860db225a Fixed #32580 -- Doc'd that HttpRequest.get_host() may raise DisallowedHost. 2021-03-26 07:35:34 +01:00
Claude Paroz cac9ec73db Refs #31003 -- Moved note about return value of QuerySet.bulk_create() to the first paragraph. 2021-03-25 17:46:22 +01:00
Chris Jerdonek ff514309e1 Fixed #32578 -- Fixed crash in CsrfViewMiddleware when a request with Origin header has an invalid host. 2021-03-25 10:34:58 +01:00
Mariusz Felisiak 5b618f239c
Fixed RemoteTestResultTest tests without tblib.
Follow up to e3bca22e7e.
2021-03-25 10:33:54 +01:00
Simon Willison e53159747c Doc'd that RawSQL can be used with __in. 2021-03-25 10:28:20 +01:00
Chris Jerdonek f3825248a2 Refs #32579 -- Fixed cookie domain comment in CsrfViewMiddleware.process_view(). 2021-03-25 06:48:36 +01:00
Chris Jerdonek 70332e6c43 Refs #32579 -- Optimized good_hosts creation in CsrfViewMiddleware.process_view(). 2021-03-25 06:39:35 +01:00
Girish Sontakke 5388ff2a52
Fixed #32582 -- Removed unnecessary dot in names of cloned test databases on SQLite. 2021-03-25 06:37:01 +01:00
Chris Jerdonek f5a2244217
Fixed typo in DiscoverRunner --reverse help text. 2021-03-24 13:39:06 +01:00
Chris Jerdonek 235d23cf99 Refs #32532 -- Added DiscoverRunner.load_tests_for_label(). 2021-03-24 13:03:53 +01:00
Mariusz Felisiak 83443e62d3
Optimized FkConstraintsTests.test_check_constraints by specifying a database table. 2021-03-24 12:18:00 +01:00
Mariusz Felisiak 94463aa861
Removed trailing whitespaces in error messages. 2021-03-24 11:44:01 +01:00
Adam Donaghy cdd0b213a8 Fixed #29606 -- Added type check for ALLOWED_HOSTS setting. 2021-03-24 09:18:44 +01:00
Nick Pope a96c730431 Fixed #32460 -- Allowed "label"/"do_not_call_in_templates" members in model choice enums. 2021-03-24 07:45:33 +01:00
Nick Pope 41e39c41c9 Refs #32460 -- Doc'd and tested that property names of model choice enums cannot be used as members. 2021-03-24 07:45:33 +01:00
Jannis Vajen 4894a97578
Fixed page numbers in Paginator.get_elided_page_range() example in docs. 2021-03-24 07:35:24 +01:00
Florian Demmer 3a185cee2a Fixed #32573 -- Fixed bounds in __iso_year lookup optimization. 2021-03-23 21:27:55 +01:00
Nick Pope 6efc35b4fe
Optimized django.utils.text.capfirst().
Unconditionally coercing to str type twice is expensive.
2021-03-23 10:45:58 +01:00
Mariusz Felisiak 2cd4026334
Refs #32353, Refs #32352 -- Fixed GIS tests with PROJ 7.X.
Different PROJ versions use different transformations, all are correct
as having a 1 meter accuracy.

These are differences in PROJ versions that cannot and should not be
handled in Django itself.

Thanks Jani Tiainen and David Smith for reports.

See: https://github.com/OSGeo/gdal/issues/3377
2021-03-23 09:16:33 +01:00
Mariusz Felisiak 71ec102b01 Fixed #32483 -- Fixed QuerySet.values()/values_list() on JSONField key transforms with booleans on SQLite.
Thanks Matthew Cornell for the report.
2021-03-23 08:28:47 +01:00
Mariusz Felisiak c4df8b86c7 Refs #32483 -- Added tests QuerySet.values()/values_list() on key transforms with structures containing booleans. 2021-03-23 08:27:14 +01:00
Mariusz Felisiak 037607ff19 Refs #31936 -- Added tests for __in lookup on JSONField key transforms with booleans. 2021-03-23 08:27:14 +01:00
Adam Johnson 562898034f Refs #31732 -- Fixed django.utils.inspect caching for bound methods.
Thanks Alexandr Artemyev for the report, and Simon Charette for the
original patch.
2021-03-22 13:17:54 +01:00
Adam Johnson ac72a216a7 Refs #31372 -- Added django.utils.inspect tests for bound methods. 2021-03-22 13:17:46 +01:00
Alex Dutton 021f946569
Updated my entry in AUTHORS. 2021-03-22 08:52:49 +01:00
tim-mccurrach cf2f6fc558
Fixed #32576 -- Corrected dumpdata docs for passing model names to the --exclude option. 2021-03-22 08:43:56 +01:00
Mariusz Felisiak 717b5e633a
Made CsrfViewMiddlewareTestMixin._get_GET_no_csrf_cookie_request() return GET requests. 2021-03-22 08:22:58 +01:00
Claude Paroz d11b9ffcc0 Fixed #32581 -- Prevented to_locale() from corrupting locale names. 2021-03-22 07:08:58 +01:00
Claude Paroz 9d130920e6 Added to_locale() tests for 3-char language codes. 2021-03-22 06:58:44 +01:00
Baptiste Mispelon 41e6b2a3c5 Fixed #32556 -- Fixed handling empty string as non-boolean attributes value by assertHTMLEqual(). 2021-03-19 20:41:57 +01:00