Commit Graph

10849 Commits

Author SHA1 Message Date
Adam Johnson 72b97a5b1e Fixed #31232 -- Changed default SECURE_REFERRER_POLICY to 'same-origin'. 2020-02-05 14:39:01 +01:00
Mariusz Felisiak 7fa1a93c6c
Refs #28214 -- Added test for escaping JSONField key lookups.
Thanks mrsanders for the report.

Fixed in 7deeabc7c7.
2020-02-05 14:31:30 +01:00
Hasan Ramezani da79ee472d Fixed #26813 -- Prevented empty choice in ModelChoiceField with RadioSelect for fields with blank=False. 2020-02-05 10:27:01 +01:00
Mariusz Felisiak 1d5fb35e6a Refs #26813 -- Added test for ModelChoiceField.choices when using RadioSelect widget. 2020-02-05 09:21:38 +01:00
Nick Pope 335c9c94ac Simplified imports from django.db and django.contrib.gis.db. 2020-02-04 13:20:06 +01:00
Claude Paroz 8ae84156d6 Fixed #27604 -- Used the cookie signer to sign message cookies.
Co-authored-by: Craig Anderson <craiga@craiga.id.au>
2020-02-04 08:05:02 +01:00
Simon Charette eb31d84532 Fixed CVE-2020-7471 -- Properly escaped StringAgg(delimiter) parameter. 2020-02-03 08:49:13 +01:00
Mariusz Felisiak 6b178a3e93
Fixed #31217 -- Made QuerySet.values()/values_list() group by not selected annotations with aggregations used in order_by().
Regression in 59b4e99dd0.

Thanks Jon Dufresne for the report and Simon Charette for the review.
2020-02-03 07:48:11 +01:00
Mariusz Felisiak a260001a2d
Refs #30943 -- Fixed postgres_tests on PostgreSQL 9.5.
Bloom extension is available on PostgreSQL 9.6+.
2020-01-31 20:42:16 +01:00
Mariusz Felisiak 2e6dc72d83
Used temporary directory in FileFieldTests.test_pickle().
Using the current directory caused a PermissionError.
2020-01-31 20:33:48 +01:00
Claude Paroz e7d62e97eb
Refs #22426 -- Removed pre-Django 1.5 messages compatibility code and test.
This reverts commit f286721f7f.
2020-01-31 11:11:24 +01:00
Hasan Ramezani a97111eabf Fixed 31207 -- Prevented references to non-local remote fields in ForeignKey.to_field.
Thanks Simon Charette for the initial patch and review.
2020-01-31 10:19:12 +01:00
Matthias Kestenholz 4e8d89020c Fixed #31219 -- Fixed object deletion crash for nested protected related objects. 2020-01-31 09:07:58 +01:00
Claude Paroz 8c0c0235b6 Added tests for signing non-string values and updated docs. 2020-01-30 11:58:39 +01:00
Hasan Ramezani 579f33eb79 Replaced assertWarns() with SimpleTestCase.assertWarnsMessage() in tests. 2020-01-30 11:19:50 +01:00
Hasan Ramezani 4ca5c565f4 Refs #27852 -- Fixed object deletion to show all restricted related objects rather than just the first one. 2020-01-29 09:02:23 +01:00
Jon Dufresne f791673537
Made token tests in auth_tests use assertIs() rather than assertTrue/False(). 2020-01-29 09:01:18 +01:00
Hasan Ramezani 2633c5341e Fixed #22261 -- Fixed resolving namespaced URLs for flatpages. 2020-01-28 13:14:23 +01:00
Mariusz Felisiak e2fab0b679 Refs #22261 -- Added missing trailing slash to the flatpages_tests urls. 2020-01-28 13:01:08 +01:00
Hannes Ljungberg 7edd06a9cf Improved SearchVectorCombinable and SearchQueryCombinable error messages. 2020-01-27 15:09:47 +01:00
Claude Paroz 50cf183d21 Refs #27468 -- Added algorithm parameter to django.utils.crypto.salted_hmac(). 2020-01-27 12:42:21 +01:00
Mariusz Felisiak c00b863ac6 Made OnDeleteTests.test_protect() assert more specific ProtectedError. 2020-01-27 12:21:02 +01:00
Hasan Ramezani ab3cbd8b9a Refs #27852 -- Fixed object deletion to show all protected related objects rather than just the first one.
Thanks Anton Samarchyan for the initial patch.
2020-01-27 12:21:02 +01:00
Claude Paroz e348ab0d43 Fixed #30997 -- Deprecated HttpRequest.is_ajax(). 2020-01-27 08:54:32 +01:00
Claude Paroz 7fa0fa45c5 Refs #30997 -- Removed HttpRequest.is_ajax() usage. 2020-01-27 08:52:40 +01:00
Claude Paroz d66d72f956 Refs #30997 -- Added HttpRequest.accepts(). 2020-01-24 14:24:59 +01:00
Hasan Ramezani b94764e178 Fixed #27888 -- Added link to clear all filters in the admin changelist view. 2020-01-23 14:14:54 +01:00
Michael Mulholland 5a68a223c7 Fixed #31200 -- Added system checks for permissions codenames max length. 2020-01-23 12:22:59 +01:00
Mariusz Felisiak b423873cb7
Refs #31197 -- Added tests for combined expressions in CheckConstraint.check.
Thanks Adam Johnson for the report.

Fixed in 306b687520.
2020-01-23 10:28:36 +01:00
Eugene Hatsko 0b013564ef Fixed #31190 -- Fixed prefetch_related() crash for GenericForeignKey with custom ContentType foreign key.
Regression in dffa3e1992.
2020-01-22 07:54:16 +01:00
Sergey Fedoseev 31e2ab345b Fixed #31195 -- Relaxed GeometryDistance test for PROJ 5.2+. 2020-01-21 22:16:23 +01:00
Sergey Fedoseev f2a725fba3 Fixed #30274 -- Prevented segmentation fault on LineString iteration.
This reverts commit 138a78ec8c and adds
a test for the regression.
2020-01-21 21:46:47 +01:00
Christopher G Johnson 33ec01caaf Refs #29095 -- Added test for using QuerySet.count() with window expressions ordered by related fields.
Fixed in 3f32154f40.
2020-01-21 10:43:21 +01:00
Tim Graham 227d0c7365 Fixed #31183 -- Added a feature flag for "<db> only supports UNBOUNDED together with PRECEDING and FOLLOWING". 2020-01-20 20:03:35 +01:00
Matthijs Kooijman 2a2ea4ee18 Refs #31117 -- Made various tests properly handle unexpected databases aliases.
- Used selected "databases" instead of django.db.connections.
- Made routers in tests.migrations skip migrations on unexpected
  databases.
- Added DiscoverRunnerGetDatabasesTests.assertSkippedDatabases() hook
  which properly asserts messages about skipped databases.
2020-01-20 14:39:02 +01:00
Matthijs Kooijman b64b1b2e1a Fixed #31117 -- Isolated backends.base.test_creation.TestDbCreationTests.
Previously, this test could modify global state by changing
connection.settings_dict. This dict is a reference to the same dict as
django.db.connections.databases['default'], which is thus also changed.
The cleanup of this test would replace connection.settings_dic` with a
saved copy, which would leave the dict itself modified.

Additionally, create_test_db() would also modify these same dicts, as
well as settings.databases['default']['NAME'] by adding a "test_"
prefix, which is what can cause problems later.

This patch:
 - makes a complete copy of the connection and work on that, to improve
   isolation.
 - calls destroy_test_db() to let that code clean up anything done by
   create_test_db().
2020-01-20 11:00:17 +01:00
Mariusz Felisiak f34be5294d Refs #31117 -- Moved get_connection_copy() test hook to a module level. 2020-01-20 11:00:05 +01:00
Sergey Fedoseev a920c0b852 Fixed #31142 -- Fixed MakeValid.output_field when geometry type is changed.
Regression in 2ef4b4795e.
2020-01-20 08:59:45 +01:00
Mariusz Felisiak 7d8df4ad03
Fixed field default in dates tests. 2020-01-18 20:07:25 +01:00
Pavel Lysak 13e4abf83e Fixed #30752 -- Allowed using ExceptionReporter subclasses in error reports. 2020-01-16 15:25:49 +01:00
Mariusz Felisiak 266c853e10
Fixed #31162 -- Prevented error logs when using WKT strings in lookups.
Thanks dbxnr for the initial patch.

Regression in 6f44f714c9.
2020-01-16 14:34:54 +01:00
Flavio Curella d08d4f464a Fixed #30765 -- Made cache_page decorator take precedence over max-age Cache-Control directive. 2020-01-16 13:39:16 +01:00
Mariusz Felisiak bf77669453
Fixed #29998 -- Allowed multiple OneToOneFields to the parent model.
We assumed that any OneToOneField's in a child model must be the
parent link and raised an error when parent_link=True was not
specified. This patch allows to specify multiple OneToOneField's to
the parent model.

OneToOneField's without a custom related_name will raise fields.E304
and fields.E305 so this should warn users when they try to override
the auto-created OneToOneField.
2020-01-16 08:06:16 +01:00
Carlton Gibson 29c126bb34 Fixed #31124 -- Fixed setting of get_FOO_display() when overriding inherited choices.
Regression in 2d38eb0ab9
2020-01-15 15:35:22 +01:00
Claude Paroz b5a62bd17d Refs #27468 -- Added explicit tests for django.utils.crypto.salted_hmac() 2020-01-15 12:53:21 +01:00
Mariusz Felisiak 59b4e99dd0
Refs #31136 -- Made QuerySet.values()/values_list() group only by selected annotation.
Regression in 0f843fdd5b.
2020-01-15 09:32:42 +01:00
chetan22 63e6ee1f99 Fixed #29871 -- Allowed setting pk=None on a child model to create a copy.
Thanks Simon Charette and Tim Graham for the initial patch.
2020-01-15 08:28:30 +01:00
Mariusz Felisiak 6f7998adc7
Fixed #31155 -- Fixed a system check for the longest choice when a named group contains only non-string values.
Regression in b6251956b6.

Thanks Murat Guchetl for the report.
2020-01-11 19:47:36 +01:00
Adam Donaghy 8b3e714ecf Fixed #30980 -- Improved error message when checking uniqueness of admin actions' __name__.
Thanks Keshav Kumar for the initial patch.
2020-01-10 14:00:28 +01:00
Carlton Gibson e2d9d66a22 Fixed #23004 -- Added request.META filtering to SafeExceptionReporterFilter.
Co-authored-by: Ryan Castner <castner.rr@gmail.com>
2020-01-10 11:35:41 +01:00
Carlton Gibson 581ba5a948 Refs #23004 -- Allowed exception reporter filters to customize settings filtering.
Thanks to Tim Graham for the original implementation idea.

Co-authored-by: Daniel Maxson <dmaxson@ccpgames.com>
2020-01-10 11:21:23 +01:00
Adam Johnson 5166097d7c Fixed #31154 -- Added support for using enumeration types in templates.
Enumeration helpers are callables, so the template system tried to call
them with no arguments.

Thanks Rupert Baker for helping discover this.
2020-01-10 07:52:06 +01:00
Carlton Gibson 4c1b401e82 Added file cleanup in FileFieldTests.test_pickle(). 2020-01-09 20:47:45 +01:00
Jack Cushman eb629f4c02 Fixed #30995 -- Allowed converter.to_url() to raise ValueError to indicate no match. 2020-01-09 14:41:41 +01:00
Hasan Ramezani eef3ea847e Fixed #31148 -- Added error messages on update()/delete() operations following union(), intersection(), and difference(). 2020-01-09 12:20:54 +01:00
Hasan Ramezani f600e3fad6 Fixed #21238 -- Fixed restoring attributes when pickling FileField and ImageField. 2020-01-09 09:37:59 +01:00
Hasan Ramezani aaea9deac4 Refs #21238 -- Added more tests for pickling FileField and ImageField. 2020-01-09 09:18:53 +01:00
Hasan Ramezani 66e16dcc99 Removed unused lines in ImageFieldTests.test_pickle(). 2020-01-09 08:44:39 +01:00
Jack Cushman 07f6ff09e4 Added tests for using the same name for multiple URL patterns. 2020-01-08 10:55:53 +01:00
Shubham singh ffcf1a8ebf Fixed #31118 -- Made FileInput to avoid the required attribute when initial data exists. 2020-01-08 09:15:31 +01:00
Mariusz Felisiak 53d8646f79
Fixed #31141 -- Relaxed system check of translation settings for sublanguages.
Regression in 4400d8296d.

Thanks Enrique Matías Sánchez for the report.
2020-01-08 08:05:43 +01:00
Mariusz Felisiak 8be477be5c
Fixed timezones tests for PyYAML 5.3+. 2020-01-07 09:54:22 +01:00
Adam Johnson 2ea3fb3e63 Removed "Don't do that" from docs and error messages.
It's slightly aggressive and doesn't explain itself.
2020-01-06 13:50:43 +01:00
Claude Paroz 1487f16f2d Fixed #11385 -- Made forms.DateTimeField accept ISO 8601 date inputs.
Thanks José Padilla for the initial patch, and Carlton Gibson for the
review.
2020-01-06 10:52:09 +01:00
Mariusz Felisiak 0f843fdd5b
Fixed #31136 -- Disabled grouping by aliases on QuerySet.values()/values_list().
Regression in fb3f034f1c.

Thanks Sigurd Ljødal for the report.
2020-01-04 20:49:11 +01:00
Claude Paroz 495d7a1ddf Reorganized forms.DateTimeField tests. 2020-01-03 10:36:58 +01:00
Simon Charette 9bcbcd599a Fixed #31133 -- Fixed crash when subtracting against a subquery annotation.
The subtract_temporals() database operation was not handling expressions
returning SQL params in mixed database types.

Regression in 3543129822.

Thanks Reupen Shah for the report.
2020-01-03 10:35:08 +01:00
Federico Jaramillo Martínez 372eaa395f Fixed #28991 -- Added EmptyFieldListFilter class in admin.filters.
Thanks Simon Charette and Carlton Gibson for reviews.

Co-Authored-By: Jonas Haag <jonas@lophus.org>
Co-Authored-By: Christophe Baldy <christophe.baldy@polyconseil.fr>
2020-01-03 07:58:04 +01:00
Mariusz Felisiak 1960d55f8b
Refs #31040 -- Fixed crypt.crypt() call in test_hashers.py.
An empty string is invalid salt in Python 3 and raises exception since
Python 3.9, see https://bugs.python.org/issue38402.
2020-01-03 07:47:04 +01:00
Patrick Seebauer e3d546a1d9 Fixed #31128 -- Fixed TemplateSyntaxError in simple_tag() and inclusion_tag() for kwargs. 2020-01-02 10:44:07 +01:00
Jon Dufresne 9762617a03 Improved tests assertions in cache tests.
Added assertions to compare results of .add(), .delete(), .touch(),
.incr(), .decr(), and .get_or_set() methods.

Made tests use assertIs() rather than assertTrue/False().
2019-12-31 12:49:36 +01:00
Mariusz Felisiak c159baceba
Refs #31117 -- Isolated backends.sqlite.test_creation.TestDbSignatureTests. 2019-12-31 12:09:50 +01:00
David Wobrock 2f565f84ac Fixed #31097 -- Fixed crash of ArrayAgg and StringAgg with filter when used in Subquery. 2019-12-31 10:35:43 +01:00
David Wobrock 7d44aeb388 Refs #31097 -- Added tests for filter in ArrayAgg and StringAgg. 2019-12-31 10:35:39 +01:00
Sjbrgsn b2bd08bb7a Fixed #30892 -- Fixed slugify() and admin's URLify.js for "İ".
Thanks Luis Nell for the implementation idea and very detailed report.

Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2019-12-30 20:47:22 +01:00
Simon Charette 5779cc938a Fixed #31071 -- Disabled insert optimization for primary keys with defaults when loading fixtures.
Model.save_base() is called directly when loading fixtures and assumes
existing rows will be updated. Branching of "raw" allows to maintain
the optimization introduced in #29260 while supporting this edge case.

Regression in 85458e94e3.

Thanks Reupen Shah for the report.
2019-12-30 07:49:10 +01:00
Mariusz Felisiak 5a68f02498
Fixed random models_fields.test_uuid.TestQuerying failures.
Random failures depended on a generated UUID.
2019-12-27 15:25:50 +01:00
Mads Jensen 62727e65fb Increased test coverage of django.utils.inspect. 2019-12-27 10:08:24 +01:00
Jon Dufresne e42b68debf Fixed #31114 -- Fixed HttpRequest.build_absolute_uri() crash with reverse_lazy() locations. 2019-12-27 09:19:56 +01:00
Claude Paroz 5660267e5b Fixed #31121 -- Cleared Site cache in SitesFrameworkTests.
Thanks Matthijs Kooijman for the report and analysis.
2019-12-27 08:57:34 +01:00
Mariusz Felisiak 22ce5d0031
Fixed #31106 -- Fixed migrations crash on PostgreSQL 10+ when adding FK constraints inline and changing data.
This allows adding foreign key constraints inline and changing data in
the same migration on PostgreSQL 10+.

Regression in 738faf9da2.

Thanks Janne Rönkkö for the report and Simon Charette for the
implementation idea and review.
2019-12-23 23:28:59 +01:00
Mariusz Felisiak 45bcc6feac
Refs #31115 -- Added test for nested subquery that references related fields.
Thanks Dmitriy Gunchenko for the report and Simon Charette for the
analysis and tests.

Regression in 5a4d7285bd.

Fixed in 5a4d7285bd.
2019-12-23 12:17:56 +01:00
Jon Dufresne 67ea35df52 Fixed #30998 -- Added ModelChoiceIteratorValue to pass the model instance to ChoiceWidget.create_option(). 2019-12-23 10:34:50 +01:00
Simon Charette 720de4d044 Fixed #31109 -- Disabled grouping by aliases on QuerySet.exists().
Clearing the SELECT clause in Query.has_results was orphaning GROUP BY
references to it.

Thanks Thierry Bastian for the report and Baptiste Mispelon for the
bisect.

Regression in fb3f034f1c.
2019-12-23 09:24:03 +01:00
Nick Pope a2d894b2e4 Refs #28954 -- Removed remaining Jython-specific code from dispatch tests.
Missed in 23b21db31b.
2019-12-19 16:42:12 +01:00
Hasan Ramezani a3fc24f014 Fixed #31095 -- Made RelatedManager.set() preserve existing m2m relations with an invalid type. 2019-12-19 13:33:05 +01:00
Simon Charette 5a4d7285bd Fixed #31094 -- Included columns referenced by subqueries in GROUP BY on aggregations.
Thanks Johannes Hoppe for the report.

Regression in fb3f034f1c.

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2019-12-19 10:04:56 +01:00
Simon Charette a0f34d8fef Refs #31094 -- Added test for not using aliases in GROUP BY clauses. 2019-12-19 09:12:29 +01:00
Mike Hansen 35d36d9462 Refs #30585 -- Updated project templates and tests to use (block)translate tags. 2019-12-18 13:15:38 +01:00
Mike Hansen d291c72bf2 Fixed #30585 -- Added {% translate %} and {% blocktranslate %} template tags. 2019-12-18 13:15:38 +01:00
Simon Charette 5b1fbcef7a Fixed CVE-2019-19844 -- Used verified user email for password reset requests.
Co-Authored-By: Florian Apolloner <florian@apolloner.eu>
2019-12-18 09:11:39 +01:00
Shubham singh f4647179cc Fixed #31086 -- Improved error message for admin model inlines with more than one foreign key to the same parent. 2019-12-17 09:15:01 +01:00
James Turk ff00a05347 Fixed #31088 -- Added support for websearch searching in SearchQuery. 2019-12-16 14:59:59 +01:00
Zeynel Özdemir 9d40b6bbf4 Fixed #31076 -- Fixed dbshell crash on Windows with Python < 3.8.
subprocess.run()'s args parameter accepts path-like objects on Windows
since Python 3.8.
2019-12-16 11:20:41 +01:00
Baptiste Mispelon 4161e35048 Refs #12679 -- Added test for using property as ModelAdmin.inlines.
Fixed in 1d8eb0cae5.
2019-12-14 21:15:44 +01:00
Baptiste Mispelon 738e9e615d Fixed #26743 -- Fixed UnboundLocalError crash when deserializing m2m fields and value isn't iterable. 2019-12-13 11:38:09 +01:00
Osaetin Daniel b33bfc3839 Fixed #30862 -- Allowed setting SameSite cookies flags to 'none'.
Thanks Florian Apolloner and Carlton Gibson for reviews.
2019-12-12 10:52:31 +01:00
Baptiste Mispelon 200cd8803d Refs #25361 -- Added test for pickling queryset of abstract-inherited models with Meta.ordering.
Fixed in 67cf5efa31.
2019-12-12 09:01:47 +01:00
Jon Dufresne 8ea3ff155e Fixed typo in tests/cache/tests.py docstring. 2019-12-11 17:39:21 +01:00
Jon Dufresne 8d087f9a17 Fixed typo in ModelChoiceFieldTests.
The subindex and attrs arguments should be passed through to the parent,
not overridden as None.
2019-12-11 15:15:12 +01:00
Jon Dufresne e703b93a65 Fixed #31080 -- Removed redundant type="text/javascript" attribute from <script> tags. 2019-12-11 09:49:54 +01:00
Baptiste Mispelon d8e2333528 Fixed #31077 -- Made debug decorators raise TypeError if they're not called.
Django will raise an error if you forget to call the decorator.
2019-12-10 13:34:28 +01:00
Peter Andersen 02eff7ef60 Fixed #31073 -- Prevented CheckboxInput.get_context() from mutating attrs. 2019-12-10 12:27:50 +01:00
Mariusz Felisiak 3fb7c12158
Refs #23433 -- Fixed test_django_admin_py.DeprecationTest tests failures on Windows and Python < 3.8.
subprocess.run()'s args parameter accepts a path-like object on Windows
since Python 3.8.
2019-12-10 11:17:50 +01:00
Baptiste Mispelon 3df3c5e670 Fixed #26480 -- Fixed crash of contrib.auth.authenticate() on decorated authenticate() methods of authentication backends.
The Signature API (PEP 362) has better support for decorated functions
(by default, it follows the __wrapped__ attribute set by
functools.wraps for example).
2019-12-10 09:36:30 +01:00
Mariusz Felisiak d6505273cd Refs #31044 -- Fixed error message when using Prefetch with a values_list() queryset. 2019-12-09 15:45:53 +01:00
Hasan Ramezani 4540842bc3 Fixed #31044 -- Errored nicely when using Prefetch with a raw() queryset. 2019-12-09 15:45:18 +01:00
Baptiste Mispelon 9e565386d3 Fixed #27430 -- Added -b/--buffer option to DiscoverRunner. 2019-12-09 13:47:12 +01:00
Mariusz Felisiak f464526388
Refs #30676 -- Added test for invalid --pdb and --parallel usage in DiscoverRunner. 2019-12-09 11:12:06 +01:00
Alex Aktsipetrov bf12273db4 Fixed #31060 -- Reallowed window expressions to be used in conditions outside of queryset filters.
Regression in 4edad1ddf6.

Thanks utapyngo for the report.
2019-12-06 13:52:16 +01:00
Jon Dufresne 5708327c37 Fixed #23433 -- Deprecated django-admin.py entry point in favor of django-admin.
Unify on the entry point created by setuptools entry_points feature.
2019-12-06 12:11:44 +01:00
Jon Dufresne 8eb0f73eed Refs #23433 -- Removed script argument from AdminScriptTestCase.run_test(). 2019-12-06 10:33:54 +01:00
Jon Dufresne 8aefe11137 Removed unnecessary __init__.py creation in admin_scripts.tests. 2019-12-06 09:57:09 +01:00
Mariusz Felisiak 82a88d2f48
Fixed #31061 -- Ignored positional args in django.urls.resolve() when all optional named parameters are missing.
Regression in 76b993a117.

Thanks Claude Paroz for the report and Carlton Gibson for reviews.
2019-12-06 09:32:51 +01:00
Hasan Ramezani 5d674eac87 Fixed #31039 -- Added support for contained_by lookup with AutoFields, SmallIntegerField, and DecimalField. 2019-12-05 15:50:39 +01:00
Carlton Gibson 6410d38ca7
Moved selenium import to nested scope. 2019-12-05 12:47:31 +01:00
Gordon Pendleton adb9661789 Fixed #31010 -- Allowed subdomains of localhost in the Host header by default when DEBUG=True. 2019-12-05 09:44:45 +01:00
Aymeric Augustin c06492dd87 Fixed #23524 -- Allowed DATABASES['TIME_ZONE'] option on PostgreSQL. 2019-12-04 18:22:08 +01:00
Baptiste Mispelon 26cab4e8c1 Fixed #31046 -- Allowed RelatedManager.add()/create()/set() to accept callable values in through_defaults. 2019-12-03 19:47:38 +01:00
Andrew Godwin c90ab30fa1 Fixed #31056 -- Allowed disabling async-unsafe check with an environment variable. 2019-12-03 17:29:31 +01:00
Jon Dufresne 65285d1e7d Refs #29892 -- Made Selenium tests wait for popups to be ready. 2019-12-02 15:06:36 +01:00
Mariusz Felisiak 845042b3d9
Refs #25705 -- Fixed invalid SQL generated by SQLFuncMixin.as_sql() in custom_lookups tests.
Generated SQL was invalid because parameters are quoted by a driver.
2019-12-02 13:58:41 +01:00
Carlton Gibson 11c5e0609b Fixed CVE-2019-19118 -- Required edit permissions on parent model for editable inlines in admin.
Thank you to Shen Ying for reporting this issue.
2019-12-02 08:56:08 +01:00
Mariusz Felisiak 0107e3d105
Fixed #30953 -- Made select_for_update() lock queryset's model when using "self" with multi-table inheritance.
Thanks Abhijeet Viswa for the report and initial patch.
2019-12-02 07:57:19 +01:00
Carlton Gibson c33eb6dcd0
Fixed #29892 -- Added explicit Selenium wait in admin autocomplete tests. 2019-11-29 14:03:22 +01:00
Baptiste Mispelon f47ba7e780 Fixed #30255 -- Fixed admindocs errors when rendering docstrings without leading newlines.
Used inspect.cleandoc() which implements PEP-257 instead of an internal
hook.
2019-11-29 12:47:42 +01:00
Mariusz Felisiak e8fcdaad5c Fixed #31021 -- Fixed proxy model permissions data migration crash with a multiple databases setup.
Regression in 98296f86b3.
2019-11-29 08:23:01 +01:00
Jon Dufresne 86a0231e0a Refs #23919 -- Replaced super(...) with super() in metaclasses. 2019-11-28 15:34:29 +01:00
Jon Dufresne c8bd37a860 Fixed #31042 -- Removed AdminSeleniumTestCase.get_css_value() in favor of Selenium .is_displayed().
All instances of AdminSeleniumTestCase.get_css_value() were used to
inspect the display property.
2019-11-28 15:10:13 +01:00
Jon Dufresne 875e3ff4fd Fixed #29892 -- Added .wait_page_loaded() in SeleniumTests.test_first_field_focus(). 2019-11-28 11:22:19 +01:00
Jon Dufresne f0ed38edf3 Refs #29892 -- Replaced Selenium .submit() shim with .click() on the submit button.
There is no WebDriver submit primitive. The Selenium project implements
it as a convenience only. The geckodriver developers recommend against
using it. Replace it with a real primitive, click on the submit button.

Fixes failing Seleninum test test_date_time_picker_shortcuts when using
the Firefox Selenium driver.
2019-11-28 09:24:19 +01:00
Johannes Hoppe 249a6190ae Fixed #30975 -- Replaced custom get_select_option with Selenium's select_by_value. 2019-11-27 16:34:07 +01:00
Johannes Hoppe 69dbb6b708 Fixed #30973 -- Converted selenium tests wait_page_loaded to context manager. 2019-11-27 14:36:26 +01:00
Hasan Ramezani 8d32290279 Fixed #30425 -- Handled jinja2.TemplateSyntaxError when rendering a template.
Jinja raises jinja2.TemplateSyntaxError in render() not in
get_template() when it's in an included template.
2019-11-27 12:48:07 +01:00
Farhaan Bukhsh 1f817daa20 Fixed #30803 -- Allowed comma separators for milliseconds in django.utils.dateparse functions.
Co-Authored-By: Ben Wilber <benwilber@gmail.com>
2019-11-27 09:43:12 +01:00
Farhaan Bukhsh 42b23d1e79 Refs #30803 -- Allowed comma separators for decimal fractions in parse_duration(). 2019-11-27 09:43:12 +01:00
Baptiste Mispelon 52936eface Fixed #31031 -- Fixed data loss in admin changelist view when formset's prefix contains regex special chars.
Regression in b18650a263.
2019-11-26 08:48:10 +01:00
Simon Charette 0290e01d5a Fixed #31002 -- Fixed GIS lookups crash against a subquery annotation.
Thanks Vasileios Bouzas for the report.
2019-11-25 12:30:33 +01:00
John Bowen 29d8198841 Fixed #27914 -- Fixed serialization of nested classes in migrations. 2019-11-25 11:12:44 +01:00
John Bowen 8008795a38 Refs #23950 --- Moved test DeconstructibleInstances class to a module level.
DeconstructibleInstances was not importable from the asserted path.
2019-11-25 11:05:09 +01:00
Sergey Fedoseev a5855c8f0f Fixed #30996 -- Added AsWKB and AsWKT GIS functions. 2019-11-22 13:40:48 +01:00
Baptiste Mispelon 8929afb8ec Fixed #9762 -- Made DateFormat.r() locale-independent.
Thanks to Antonio Melé for the original report all those years ago
and to all the contributors who helped along the way.
2019-11-22 12:41:53 +01:00
Baptiste Mispelon 76ec032712 Refs #26281 -- Added a helpful error message for an invalid "r" specifier to dateformat.format(). 2019-11-22 12:32:30 +01:00
Simon Charette 379bf1a2d4 Fixed #8467 -- Prevented crash when adding existent m2m relation with an invalid type.
This was an issue anymore on backends that allows conflicts to be
ignored (Refs #19544) as long the provided values were coercible to the
expected type. However on the remaining backends that don't support
this feature, namely Oracle, this could still result in an
IntegrityError.

By attempting to coerce the provided values to the expected types in
Python beforehand we allow the existing value set intersection in
ManyRelatedManager._get_missing_target_ids to prevent the problematic
insertion attempts.

Thanks Baptiste Mispelon for triaging this old ticket against the
current state of the master branch.
2019-11-22 09:08:10 +01:00
Simon Charette 8cc711999a Refs #8467 -- Added test for RelatedManager.add()/remove() with an invalid type. 2019-11-22 09:04:03 +01:00
Carlton Gibson ee4a19053a Fixed #31012 -- Reverted "Fixed #29056 -- Fixed HTML5 validation of required SelectDateWidget."
This reverts commit f038214d91.

The initial issue was incorrect. Django 2.2, and before, did not
generate invalid HTML as reported. With f03821 in place invalid HTML
was generated.

Thanks to Kevin Brown for follow-up report and investigation.
2019-11-21 20:53:31 +01:00
Farhaan Bukhsh 664c98f1f8 Fixed #30413 -- Fixed test database signature on SQLite when test database name is provided.
Previously, the same signature was created for multiple in-memory
databases on SQLite when they had tests databases names
DATABASES['TEST']['NAME'].
2019-11-21 19:50:24 +01:00
Simon Charette f97a6123c0 Refs #25367 -- Made Query.build_filter() raise TypeError on non-conditional expressions. 2019-11-21 11:56:35 +01:00
Simon Charette e9a0e1d4f6 Fixed #30484 -- Added conditional expressions support to CheckConstraint. 2019-11-21 11:56:35 +01:00
Simon Charette 306b687520 Refs #11964 -- Removed SimpleCol in favor of Query(alias_cols).
This prevent having to pass simple_col through multiple function calls
by defining whether or not references should be resolved with aliases
at the Query level.
2019-11-21 11:56:35 +01:00
Jon Dufresne f5ebdfce5c Fixed #25388 -- Added an option to allow disabling of migrations during test database creation. 2019-11-20 20:42:38 +01:00
Carlton Gibson 36453526d3
Pinned asgiref version. 2019-11-20 14:57:08 +01:00
Hasan Ramezani 0284a26af9 Fixed #30981 -- Fixed admin changelist crash when using F() or OrderBy() expressions in admin_order_field. 2019-11-19 15:40:04 +01:00
Daniel Izquierdo 89abecc75d Fixed #27272 -- Added an on_delete RESTRICT handler to allow cascading deletions while protecting direct ones. 2019-11-19 10:55:05 +01:00
Caio Ariede 555bebe774 Fixed #30987 -- Added models.PositiveBigIntegerField. 2019-11-19 09:34:11 +01:00
Jon Dufresne aa12cf07c9 Removed unnecessary numeric indexes in format strings. 2019-11-19 08:29:47 +01:00
Sergey Fedoseev f95b59a1b3 Fixed #30994 -- Added Oracle support for AsGeoJSON GIS function. 2019-11-18 15:32:44 +01:00
Jon Dufresne 7f0946298e Replaced encode() usage with bytes literals. 2019-11-18 15:31:42 +01:00
Jon Dufresne 57a3d96ff5 Replaced unnecessary str()/bytes() calls with literals. 2019-11-18 15:30:10 +01:00
Jon Dufresne e649d691f8 Removed unnecessary parentheses in various code. 2019-11-18 15:25:59 +01:00
Simon Charette 11e327a3ff Fixed #30988 -- Deprecated the InvalidQuery exception.
It was barely documented without pointers at its defining location and
was abused to prevent misuse of the QuerySet field deferring feature.
2019-11-18 14:06:51 +01:00
Tim Graham 9100c664db Relaxed some query ordering assertions in tests.
It accounts for differences seen on cockroachdb.
2019-11-18 12:32:37 +01:00
Baptiste Mispelon 18e10740a4 Refs #30990 -- Added test for 'z' date format with a leap year. 2019-11-18 11:30:18 +01:00
Mariusz Felisiak 8685e764ef Fixed #30986 -- Fixed queryset crash when filtering against boolean RawSQL expressions on Oracle. 2019-11-18 08:50:09 +01:00
Tim Graham 22a7a406c9 Removed hardcoded pk in view_tests.tests.test_defaults. 2019-11-18 08:46:39 +01:00
Tim Graham 7f61b6b039 Removed hardcoded pk in test_pk_set_on_repeated_add_remove.
Follow up to bed4a1527b.
2019-11-18 08:46:39 +01:00
Mariusz Felisiak 4527d5db0f
Refs #29808 -- Fixed MigrateTests.test_migrate_fake_initial_case_insensitive() crash on Oracle. 2019-11-15 21:05:42 +01:00
Hasan Ramezani 530dd193f2 Fixed #29808 -- Fixed initial migration detection when identifiers are case-insensitive.
Thanks Simon Charette for the review.
2019-11-15 09:01:30 +01:00
Dulmandakh 24b9f50823 Fixed #29916 -- Added lower_inc, lower_inf, upper_inc, and upper_inf lookups for RangeFields.
Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2019-11-14 22:27:29 +01:00
daniel a rios efc3e32d6d Fixed #30759 -- Made cache.delete() return whether it succeeded.
Thanks Simon Charette for the review.
2019-11-14 11:14:11 +01:00
Mariusz Felisiak ca0d50f34a Fixed random auth_tests.test_tokens.TokenGeneratorTest.test_10265 failures.
Random failures depended on the current timestamp.
2019-11-13 14:22:23 +01:00
Mariusz Felisiak 3b4b36fb1d Moved MockedPasswordResetTokenGenerator outside of TokenGeneratorTest.test_timeout(). 2019-11-13 14:22:23 +01:00
George Marshall 8be79984dc Fixed #30971 -- Prevented Query.resolve_lookup_value() from coercing list values to tuples.
Regression in 8a281aa7fe.
2019-11-13 08:27:26 +01:00
Hasan Ramezani 4b78546ef1 Fixed #30405 -- Fixed source code mismatch crash in ExceptionReporter. 2019-11-12 11:31:12 +01:00
Hannes Ljungberg 6e2f05b2e3 Fixed #30967 -- Fixed TrigramTest failures on PostgreSQL 12+. 2019-11-11 12:58:49 +01:00
Hasan Ramezani 153c7956f8 Fixed #24858 -- Added support for get_FOO_display() to ArrayField and RangeFields.
_get_FIELD_display() crashed when Field.choices was unhashable.
2019-11-08 10:59:24 +01:00
Hannes Ljungberg 6d590bcf1f Fixed #30961 -- Fixed spaces in columns list SQL generated for indexes. 2019-11-08 08:52:47 +01:00
Hannes Ljungberg d5af43c8d1 Refs #30961 -- Added tests for columns list SQL generated for indexes. 2019-11-08 08:35:39 +01:00
Nick Pope 02983c5242 Fixed #30943 -- Added BloomIndex to django.contrib.postgres. 2019-11-07 11:23:53 +01:00
Jon Dufresne 77aa74cb70 Refs #29983 -- Added support for using pathlib.Path in all settings. 2019-11-07 10:26:22 +01:00
Jon Dufresne 39791c8e6d Harmonized Windows checks in tests to a single style. 2019-11-06 15:14:30 +01:00
Jon Dufresne e3c2fae4cd Adjusted expected exception message for Windows.
Test failure introduced in fbbff7f808.

Windows uses a different error message when a non-path is passed to
os.path functions.
2019-11-06 14:34:44 +01:00
Jon Dufresne 74f2a58b3a Refs #29983 -- Added tests for FileBasedCache pathlib support. 2019-11-06 10:01:01 +01:00
Jon Dufresne fbbff7f808 Refs #29983 -- Added pathlib.Path support to the file email backend. 2019-11-06 09:33:07 +01:00
Stephen Rauch 4b6db766ba Refs #30183 -- Doc'd dropping support for sqlparse < 0.2.2.
Support for sqlparse < 0.2.2 was broken in
782d85b6df because is_whitespace property
was added in sqlparse 0.2.2.
2019-11-06 08:45:43 +01:00
Jon Dufresne 1c4c68dfed Refs #29983 -- Added test for FILE_UPLOAD_TEMP_DIR pathlib support. 2019-11-06 08:20:23 +01:00
Jon Dufresne 92e5abd7a3 Refs #29983 -- Added test for FIXTURES_DIRS pathlib support. 2019-11-06 08:06:55 +01:00
Jon Dufresne edeec1247e Passed strict=True to Path.resolve() to enforce that the path must exist. 2019-11-05 14:22:20 +01:00
Hasan Ramezani 47379d027b Fixed #30095 -- Fixed system check for RangeField/ArrayField.choices with lists and tuples. 2019-11-05 11:48:44 +01:00
Jon Dufresne e0e88ceaaa Refs #30116 -- Simplified stdout/stderr decoding with subprocess.run()'s encoding argument.
The encoding argument has been available since Python 3.6.
https://docs.python.org/3/library/subprocess.html#subprocess.run
2019-11-04 11:21:25 +01:00
Jon Dufresne 607004f81a Simplified consecutive calls to pathlib.Path.parent. 2019-11-04 09:59:34 +01:00
Carlton Gibson 2d38eb0ab9 Fixed #30931 -- Restored ability to override Model.get_FIELD_display().
Thanks Sergey Fedoseev for the implementation idea.

Regression in a68ea23101.
2019-11-04 07:55:34 +01:00
Hasan Ramezani 8463390527 Refs #27808 -- Added test for saving nested ArrayField with nullable base field. 2019-11-01 15:56:21 +01:00
Sky 3cf907c20c Fixed #30761 -- Prevented floatformat filter from returning a negative zero. 2019-10-31 10:48:35 +01:00
Sky 459de8dc29 Added more tests for floatformat filter with negative values. 2019-10-31 10:07:59 +01:00
Hasan Ramezani 17752003a8 Refs #28428 -- Made FileSystemStorage.save() to support pathlib.Path. 2019-10-31 09:06:05 +01:00
Hasan Ramezani 0f2975534d Refs #28428 -- Added tests for using FileSystemStorage with pathlib.Path. 2019-10-31 08:52:15 +01:00
Felipe Lee c2c27867ef Refs #20456 -- Moved initialization of HEAD method based on GET to the View.setup() for generic views.
This will ease unit testing of views since setup will essentially do
everything needed to set the view instance up (other than instantiating
it). Credit for idea goes to Vincent Prouillet.
2019-10-30 14:43:52 +01:00
Felipe Lee 31d1822532 Refs #20456 -- Added test for initialization of request/args/kwargs attributes in View.Setup(). 2019-10-30 14:43:47 +01:00
Hasan Ramezani 6315a272c5 Refs #28428 -- Made filepath_to_uri() support pathlib.Path. 2019-10-30 13:13:15 +01:00