Commit Graph

11078 Commits

Author SHA1 Message Date
David Smith 5cc2c63f90
Fixed typo in tests/forms_tests/widget_tests/test_clearablefileinput.py docstring. 2020-03-11 08:50:51 +01:00
Claude Paroz e3e48b0012
Fixed #30439 -- Added support for different plural forms for a language.
Thanks to Michal Čihař for review.
2020-03-10 15:56:32 +01:00
Hasan Ramezani 591e2270dc Fixed #26513 -- Added tests for <Backend>GeometryColumns.geom_col_name(). 2020-03-10 12:22:35 +01:00
Mariusz Felisiak c48a7d3a8a Fixed typos in tolerance gis_tests. 2020-03-10 07:55:31 +01:00
Jon Dufresne eb77e80de0 Fixed #31349 -- Used :nth-child() CSS pseudo-class to style alternative rows in admin. 2020-03-09 12:34:32 +01:00
Hasan Ramezani ec292f261d Fixed #31347 -- Checked allow_migrate() in CreateExtension operation. 2020-03-09 12:13:18 +01:00
David Wobrock d88365708c Fixed #31318 -- Allowed sqlmigrate to inspect squashed migrations. 2020-03-09 08:42:30 +01:00
David Wobrock b88ad1d356 Refs #31318 -- Added tests for inspecting squashed migrations and ambiguous names in sqlmigrate. 2020-03-09 08:21:34 +01:00
Mariusz Felisiak 9358da704e Refs #30489 -- Fixed RasterFieldTest.test_deserialize_with_pixeltype_flags() when run without numpy. 2020-03-07 22:46:13 +01:00
Mariusz Felisiak a3917c323f Replaced deprecated assertEquals() with assertEqual() in RasterFieldTest. 2020-03-07 22:46:13 +01:00
Simon Charette 7c8b043a03 Refs #31304 -- Made __search lookup default to its rhs' config.
This make the SearchLookup lookup more coherent with its
SearchVectorExact base which configures its rhs SearchQuery with its
lhs' config.
2020-03-06 10:23:39 +01:00
shankarj67 df4d622cac Fixed #31345 -- Added BaseDatabaseIntrospection.get_relations(). 2020-03-06 08:53:32 +01:00
Andrew Godwin 17009e9105 Refs #31224 -- Added autoconversion of test async methods. 2020-03-05 14:29:21 +01:00
Abhijeet Viswa babd412685 Fixed #29129 -- Skipped UPDATE when adding a model instance with inherited primary key that has a default. 2020-03-05 12:08:38 +01:00
Hasan Ramezani 7e15795bf0 Fixed #30489 -- Fixed RasterField deserialization with pixeltype flags.
Thanks Ivor Bosloper for the original patch.
2020-03-05 09:44:44 +01:00
Jon Dufresne 769cee5252 Fixed #31327 -- Deprecated providing_args argument for Signal. 2020-03-05 09:38:52 +01:00
Mariusz Felisiak 5ca76baa72
Fixed GeoQuerySetTest.test_unionagg_tolerance() test on Oracle 18c. 2020-03-05 08:55:34 +01:00
aryan 427a7e419b Fixed #31333 -- Added BaseDatabaseIntrospection.get_table_description(). 2020-03-04 12:26:31 +01:00
Mariusz Felisiak 6dea42feba Added tests for BaseDatabaseIntrospection's stub methods. 2020-03-04 12:25:17 +01:00
Mariusz Felisiak 6695d29b1c Fixed CVE-2020-9402 -- Properly escaped tolerance parameter in GIS functions and aggregates on Oracle.
Thanks to Norbert Szetei for the report.
2020-03-04 09:04:50 +01:00
Hannes Ljungberg 65ab4f9f03 Fixed #31147 -- Added SearchHeadline to django.contrib.postgres. 2020-03-03 15:39:52 +01:00
Mariusz Felisiak aee0bebc2f Refs #31331 -- Checked ONLY_FULL_GROUP_BY mode in AggregateTestCase.test_aggregation_subquery_annotation_multivalued(). 2020-03-03 11:25:37 +01:00
Mariusz Felisiak a19505eb2e Refs #31331 -- Added DatabaseWrapper.sql_mode to MySQL. 2020-03-03 11:25:37 +01:00
Mariusz Felisiak 7b8fa1653f Fixed #31150 -- Included subqueries that reference related fields in GROUP BY clauses.
Thanks Johannes Hoppe for the report.

Regression in fb3f034f1c.

Co-authored-by: Simon Charette <charette.s@gmail.com>
2020-03-03 11:25:37 +01:00
Claude Paroz d4fff711d4 Fixed #31274 -- Used signing infrastructure in SessionBase.encode()/decode().
Thanks Mariusz Felisiak and Florian Apolloner for the reviews.
2020-03-02 12:16:48 +01:00
007 e65fea9292 Fixed #31293 -- Allowed MultiPartParser to handle double-quoted encoded headers. 2020-02-28 14:43:16 +01:00
Hans Aarne Liblik a21f7b91db Fixed #31301 -- Fixed crash of QuerySet.bulk_create() with mixed empty and set ForeignKeys to AutoFields on Oracle. 2020-02-28 12:56:03 +01:00
Cristobal Mackenzie 984531f96e Fixed #31314 -- Raised CommandError when locale is not specified in makemessages.
Regression in 0707b824fe.
2020-02-28 10:11:19 +01:00
Matheus Cunha Motta e908eb6287 Fixed #31310 -- Fixed hints in checks for using intermediate model with ambiguous foreign key.
symmetrical=False is not required since
87b1ad6e73.
2020-02-28 08:38:57 +01:00
Matheus Cunha Motta 308fab9241 Refs #31310 -- Added test for check for using intermediate model with ambiguous foreign key from model. 2020-02-28 08:26:41 +01:00
Rohit 486786c4c4 Fixed #31251 -- Disabled grouping by OuterRef() annotation. 2020-02-27 13:02:49 +01:00
Valze 5bf28ac2ed Fixed #31185 -- Fixed detecting of unique fields in ForeignKey/ForeignObject checks when using Meta.constraints. 2020-02-27 10:53:29 +01:00
Simon Charette 41ebe60728 Fixed #31312 -- Properly ordered temporal subtraction params on MySQL.
Regression in 9bcbcd599a.

Thanks rick2ricks for the report.
2020-02-27 08:50:55 +01:00
Colton Hicks f283ffaa84 Fixed #28699 -- Fixed CSRF validation with remote user middleware.
Ensured process_view() always accesses the CSRF token from the session
or cookie, rather than the request, as rotate_token() may have been called
by an authentication middleware during the process_request() phase.
2020-02-26 17:25:20 +01:00
Hasan Ramezani bc1c034076 Fixed #28280 -- Prevented numberformat.format() from formatting large/tiny floats in scientific notation. 2020-02-26 16:02:53 +01:00
aryan fba5d3b6e6 Fixed #31289 -- Added hint for USERNAME_FIELD/REQUIRED_FIELDS system check. 2020-02-26 08:40:36 +01:00
Simon Charette d0f1c03331 Refs #31211 -- Prevented SearchConfig nesting in SearchVector and SearchQuery init.
Passing a SearchConfig instance directly to SearchVector and
SearchQuery would result in nested SearchConfig instance.
2020-02-26 08:03:46 +01:00
Ram Rachum 5b09354954
Fixed #31291 -- Renamed salt to mask for CSRF tokens. 2020-02-25 14:16:19 +01:00
Taoup 271fdab8b7 Fixed #31286 -- Made database specific fields checks databases aware.
Follow up to 0b83c8cc4d.
2020-02-24 14:23:46 +01:00
Mariusz Felisiak 94d4bd3a09
Fixed backends tests on Oracle.
Using Person in test_introspection caused removing constraints in
intermediate table for ManyToManyField in
VeryLongModelNameZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ that were
expected by other transaction tests. A model without any constraints
was used to prevent isolation issues.
2020-02-24 14:21:50 +01:00
Diederik van der Boor 84e35f4679 Fixed #31292 -- Fixed django.contrib.gis.gdal.gdal_full_version() crash. 2020-02-24 13:28:51 +01:00
Diederik van der Boor 975eb42036 Added test for django.contrib.gis.gdal.gdal_version(). 2020-02-24 13:15:35 +01:00
Jon Dufresne f02c1fcf4c
Corrected typo in test docstring. 2020-02-20 09:12:09 +01:00
Jon Dufresne 94d1d4a71b Captured logging in DebugViewTests with assertLogs(). 2020-02-20 09:07:15 +01:00
Mariusz Felisiak 4261907ff3 Fixed tests when run in reverse.
Regression in 98f23a8af0.
2020-02-19 14:48:26 +01:00
Fabio Sangiovanni b457068cf2 Fixed #31187 -- Fixed detecting of existing total ordering in admin changelist when using Meta.constraints.
Detection of existing total ordering in admin changelist now takes into
account non-partial unique constraints.
2020-02-19 09:36:23 +01:00
Fabio Sangiovanni 73a34f3fa8 Removed duplicate tests in ChangeListTests.test_total_ordering_optimization(). 2020-02-19 07:43:50 +01:00
Yoo In Keun 4ef107e34f Fixed typos in docs and a test comment. 2020-02-19 07:08:23 +01:00
Claude Paroz 4d973f5939 Refs #26601 -- Deprecated passing None as get_response arg to middleware classes.
This is the new contract since middleware refactoring in Django 1.10.

Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-02-18 20:03:44 +01:00
Carlton Gibson a34cb5a6d4 Refs #31282 -- Clarified M2O add/remove/set with PK behaviour.
Improved error message for remove() and added tests.
2020-02-18 19:54:29 +01:00
Mariusz Felisiak 2a038521c4
Fixed #31271 -- Preserved ordering when unifying query parameters on Oracle.
This caused misplacing parameters in logged SQL queries.

Regression in 79065b55a7.

Thanks Hans Aarne Liblik for the report.
2020-02-18 11:45:12 +01:00
Taoup cbb6531e5b Fixed #31228 -- Reallowed aggregates to be used with multiple expressions and no DISTINCT on SQLite.
Regression in bc05547cd8.

Thanks Andy Terra for the report.
2020-02-18 10:32:23 +01:00
Keshav Kumar f37d548ede Fixed #20995 -- Added support for iterables of template names to {% include %} template tag.
Thanks Adam Johnson for the review.
2020-02-18 06:56:05 +01:00
Xavier Francisco 8690878507 Fixed #31277 -- Relaxed system check of m2m intermediary tables for db_table collision when database routers are installed.
Turned the error into a warning when database routers are installed.
2020-02-17 13:53:45 +01:00
Matthijs Kooijman 98f23a8af0 Fixed #26552 -- Deferred constraint checks when reloading the database with data for tests.
deserialize_db_from_string() loads the full serialized database
contents, which might contain forward references and cycles. That
caused IntegrityError because constraints were checked immediately.

Now, it loads data in a transaction with constraint checks deferred
until the end of the transaction.
2020-02-14 13:18:06 +01:00
Mariusz Felisiak b330b918e9
Removed unused and incorrect PossessedCar.__str__() method in test_utils.
PossessedCar doesn't have a color.
2020-02-14 13:16:17 +01:00
Claude Paroz cd2d508707 Removed redundant MiddlewareTest.test_old_style_request() test.
CurrentSiteMiddleware.process_request() is already covered by
MiddlewareTest.test_request().
2020-02-14 10:35:58 +01:00
Claude Paroz 6fba85b766 Removed unused cache.tests.CacheUtils._set_cache().
Unused since its introduction in 71a03e01aa.
2020-02-13 13:53:12 +01:00
yura 54b7af7eb4 Fixed #31250 -- Ignored processing instructions in assertXMLEqual()/assertXMLNotEqual(). 2020-02-13 11:03:54 +01:00
Dennis Schwertel 4070d6ceb0 Fixed #31267 -- Added tests cases with empty username or password for URLValidator.
Follow up to cdcf4164be.
2020-02-13 08:32:20 +01:00
Hasan Ramezani 49275c5488 Fixed #30261 -- Prevented Form._html_output() from mutating errors if hidden fields have errors. 2020-02-13 08:12:44 +01:00
Claude Paroz da4923ea87 Refs #27468 -- Made PasswordResetTokenGenerator use SHA-256 algorithm. 2020-02-12 21:46:56 +01:00
Claude Paroz 27f67317da Removed unnecessary token regex in auth_tests URLs.
All URLs in django.contrib.auth use a "<uidb64>/<token>" pattern.
2020-02-12 10:45:53 +01:00
Abhijeet Viswa 1712a76b9d Fixed #31246 -- Fixed locking models in QuerySet.select_for_update(of=()) for related fields and parent link fields with multi-table inheritance.
Partly regression in 0107e3d105.
2020-02-11 20:43:57 +01:00
Florian Apolloner 41a3b3d186 Fixed #31240 -- Properly closed FileResponse when wsgi.file_wrapper is used.
Thanks to Oskar Persson for the report.
2020-02-11 20:39:12 +01:00
Florian Apolloner 549445519c Reverted "Fixed #30565 -- Closed HttpResponse when wsgi.file_wrapper closes file-like object."
This reverts commit cce47ff65a.
2020-02-11 20:39:12 +01:00
Jon Dufresne e3f6e18513 Fixed #31253 -- Fixed data loss possibility when using caching from async code.
Case missed in a415ce70be.
2020-02-11 09:09:25 +01:00
=Pratik Kumar 20ba3ce4ac Fixed #30846 -- Made PostGIS backend respect Index's name argument. 2020-02-10 13:25:32 +01:00
Hannes Ljungberg adcf1a7308 Fixed #31248 -- Added missing space before USING SQL on PostGIS. 2020-02-10 11:20:45 +01:00
Adam Johnson 382af9b141 Fixed #31003 -- Doc'd and tested return value of QuerySet.bulk_create(). 2020-02-10 08:36:50 +01:00
Mariusz Felisiak 708c534e0b Refs #31055 -- Fixed Model.check() call in ConstraintsTests.test_check_constraints_required_db_features(). 2020-02-08 17:23:35 +01:00
Hasan Ramezani fc4f45ebdc Used assertRaisesMessage() in various tests. 2020-02-07 12:46:23 +01:00
Simon Charette 71756bdfed Fixed #31055 -- Made constraint checks support databases aware. 2020-02-07 11:03:53 +01:00
Simon Charette 0b83c8cc4d Refs #31055 -- Added --database option to the check management command.
This avoids enabling the ``database`` checks unless they are explicitly
requested and allows to disable on a per-alias basis which is required
when only creating a subset of the test databases.

This also removes unnecessary BaseCommand._run_checks() hook.
2020-02-07 11:01:31 +01:00
Jon Dufresne 3259983f56 Fixed #31233 -- Closed database connections and cursors after use. 2020-02-06 15:35:23 +01:00
Jon Dufresne f48f671223 Refs #31233 -- Changed DatabaseWrapper._nodb_connection to _nodb_cursor().
It is now a method instead of a property and returns a context manager
that yields a cursor on entry and closes the cursor and connection upon
exit.
2020-02-06 15:29:38 +01:00
Nikita Sobolev 2d55cb5c4a
Fixed typo in tests/model_inheritance/tests.py. 2020-02-06 14:20:02 +01:00
Jon Dufresne 2905b41670
Refs #31233 -- Added "error" filter for RuntimeWarning during tests. 2020-02-06 09:46:59 +01:00
adamb70 4c6ab1f2aa Fixed #28528 -- Allowed combining SearchVectors with different configs. 2020-02-06 07:52:50 +01:00
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
Nick Pope 7552de7866 Used more specific unittest assertions in tests.
* assertIsNone()/assertIsNotNone() instead of comparing to None.
* assertLess() for < comparisons.
* assertIs() for 'is' expressions.
* assertIsInstance() for isinstance() expressions.
* rounding of assertAlmostEqual() for round() expressions.
* assertIs(..., True/False) instead of comparing to True/False.
* assertIs()/assertIsNot() for ==/!= comparisons.
* assertNotEqual() for == comparisons.
* assertTrue()/assertFalse() instead of comparing to True/False.
2019-10-29 12:37:30 +01:00
Erwin Junge a6cb8ec389 Fixed #30922 -- Fixed ModelAdmin.date_hierarchy queries with DST changes.
There was an issue where admin date_hierarchy didn't render last day of
a month in DST-switch month.
2019-10-29 11:21:03 +01:00
Hasan Ramezani 6c6d24a4fe Refs #30908 -- Added test for nonexistent path in forms.FilePathField. 2019-10-29 08:39:56 +01:00
Hasan Ramezani 52cb419072 Fixed #30918 -- Made timesince()/timeuntil() respect custom time strings for future and the same datetimes. 2019-10-28 12:28:18 +01:00
Pavel Dedik 711a7d4d50 Fixed #30907 -- Fixed SplitArrayField.has_changed() with removal of empty trailing values. 2019-10-28 10:32:34 +01:00
Pavel Dedik d95b1ddcbe Refs #30907 -- Added more tests for SplitArrayField.has_changed(). 2019-10-28 10:32:05 +01:00
Sergey Fedoseev 6bbf9a20e2 Fixed #29770 -- Added LinearRing.is_counterclockwise property. 2019-10-25 14:28:26 +02:00
Carlton Gibson 24e540fbd7 Fixed #29087 -- Added delete buttons for unsaved admin inlines on validation error. 2019-10-25 13:28:08 +02:00
Carlton Gibson dbcd7b064e Fixed #30902 -- Added __str__() for model choice enums.
Allows expected behavior when cast to str, also matching behaviour of
created instances with those fetched from the DB.

Thanks to Simon Charette, Nick Pope, and Shai Berger for reviews.
2019-10-25 09:19:56 +02:00
Nick Pope 55df1750be Refs #30897 -- Added support for ANALYZE option to Queryset.explain() on MariaDB and MySQL 8.0.18+. 2019-10-24 15:13:26 +02:00
Nick Pope 742961332e Refs #30897 -- Added support for TREE format to Queryset.explain() on MySQL 8.0.16+. 2019-10-24 15:13:23 +02:00
Simon Charette 7acef095d7 Fixed #23576 -- Implemented multi-alias fast-path deletion in MySQL backend.
This required moving the entirety of DELETE SQL generation to the
compiler where it should have been in the first place and implementing
a specialized compiler on MySQL/MariaDB.

The MySQL compiler relies on the "DELETE table FROM table JOIN" syntax
for queries spanning over multiple tables.
2019-10-24 12:24:53 +02:00
Carlton Gibson e83c300a33 Fixed #30900 -- Skipped async-related tests on Windows using Python 3.8.0.
Refs https://bugs.python.org/issue38563.
2019-10-24 10:43:05 +02:00
Hannes Ljungberg fa5f3291e7 Fixed #30903 -- Fixed migrations crash on PostgreSQL when adding Index with opclasses and ordering. 2019-10-24 09:33:14 +02:00
Mariusz Felisiak 25903e41fb Refs #29926 -- Bumped minimum tblib version to 1.5.0 in test requirements. 2019-10-23 15:26:04 +02:00
Mariusz Felisiak e10ebf43e1
Bumped minimum Pillow version to 6.2.0 in test requirements.
Pillow < 6.2.0 is vulnerable to CVE-2019-16865.
2019-10-23 15:07:06 +02:00
Nick Pope 6e9189c080 Refs #30897 -- Added test for SETTINGS option to Queryset.explain() on PostgreSQL 12+. 2019-10-23 14:07:18 +02:00
Nick Pope a5c5ae7d91 Refs #28574 -- Used feature flag for PostgreSQL version check. 2019-10-23 14:07:13 +02:00
Dan Moore bc94e3c1a2 Fixed #29919 -- Fixed RelatedOnlyFieldListFilter crash with reverse relationships. 2019-10-23 10:50:31 +02:00
Dan Moore f3855a8d2d Added tests for Field.get_choices()'s limit_choices_to argument. 2019-10-23 10:47:17 +02:00
Sergey Fedoseev d4e767911f Added tests for middlewares' checks. 2019-10-23 08:18:02 +02:00
Mariusz Felisiak 2847d2c760
Refs #29926 -- Skipped RemoteTestResultTest.test_add_failing_subtests() on Python 3.8+ and tblib <= 1.4.0. 2019-10-22 15:34:19 +02:00
Alex Aktsipetrov 681f7e2b13 Fixed #20577 -- Deferred filtering of prefetched related querysets.
Added internal interface to QuerySet that allows to defer next filter
call till .query is accessed. Used it to optimize prefetch_related().

Thanks Simon Charette for the review.
2019-10-21 13:21:54 +02:00
Ahmet Kucuk 09578f6dfb Fixed #30827 -- Made batch_size arg of QuerySet.bulk_create() respect DatabaseOperations.bulk_batch_size().
Thanks Chetan Khanna for tests.
2019-10-21 11:46:44 +02:00
André Ericson 3120490912 Fixed #30876 -- Moved classproperty() decorator to the django.utils.functional. 2019-10-21 09:57:39 +02:00
André Ericson 31174031f1 Fixed #30841 -- Deprecated using non-boolean values for isnull lookup. 2019-10-21 08:44:20 +02:00
Jon Dufresne 2f72480fbd Replaced deprecated assertEquals() with assertEqual(). 2019-10-21 07:52:17 +02:00
Pavel Savchenko 1711c509fa Fixed #27391 -- Implemented SimpleTestCase.debug().
debug() should bubbled up exceptions if occurring in test, but behave
the same as run() when no exceptions occurred.
2019-10-18 12:22:51 +02:00
Pavel Savchenko dc8cd2fefd Refs #27391 -- Added more tests for SimpleTestCase. 2019-10-18 11:11:34 +02:00
Patrick Jenkins 46e74a5256 Fixed #28337 -- Preserved extra headers of requests made with django.test.Client in assertRedirects().
Co-Authored-By: Hasan Ramezani <hasan.r67@gmail.com>
2019-10-18 08:42:51 +02:00
Daniel Musketa 3ca9df51c7 Fixed typo in tests/admin_scripts/tests.py. 2019-10-18 07:50:59 +02:00
Mariusz Felisiak 3a8af298b9 Fixed #30890 -- Added MariaDB support for the relate lookup. 2019-10-18 07:46:31 +02:00
Mariusz Felisiak bebf61de11 Added gis_tests.utils.mariadb hook. 2019-10-18 07:46:31 +02:00
Hasan Ramezani ef4beafa2c Refs #28816 -- Prevented silencing data loss when decreasing CharField.max_length for ArrayField.base_field on PostgreSQL. 2019-10-17 12:50:53 +02:00
sage 6f82df69ef Refs #12990 -- Moved CheckFieldDefaultMixin to the django.db.models.fields.mixins. 2019-10-17 12:30:29 +02:00
Mariusz Felisiak 1877ec1875
Refs #27910 -- Added __init__.py file for model_enums tests. 2019-10-15 21:27:22 +02:00
Carlton Gibson 1de9a92295 Fixed #30872 -- Improved unknown command message when settings are manually configured. 2019-10-15 13:04:32 +02:00
Mariusz Felisiak 06d34aab7c Fixed #30870 -- Fixed showing that RunPython operations are irreversible by migrate --plan.
Thanks Hasan Ramezani for the initial patch and Kyle Dickerson for the
report.
2019-10-14 11:13:27 +02:00
Mariusz Felisiak 05186c03a3 Isolated migrations.test_commands.MigrateTests.test_migrate_plan. 2019-10-14 08:42:38 +02:00
Simon Charette 2839659b42 Fixed #30868 -- Prevented unnecessary AlterField when renaming a referenced pk.
Regression introduced by dcdd219ee1, refs #25817.

Thanks Carlos E. C. Leite for the report and Mariusz for the bisect.
2019-10-14 08:02:26 +02:00
Etienne Chové e7cdb0cd7e Fixed #30014 -- Fixed ModelChoiceField validation when initial value is a model instance.
Thanks Carlton Gibson for reviews.
2019-10-11 13:28:09 +02:00
Etienne Chové a12f9cd95a Added ModelChoiceField test for validation with to_field_name. 2019-10-11 13:28:06 +02:00
Louise Grandjonc 7d1bf29977 Fixed #30826 -- Fixed crash of many JSONField lookups when one hand side is key transform.
Regression in 6c3dfba892.
2019-10-11 10:55:22 +02:00
Hasan Ramezani 6a75cea76a Fixed #30854 -- Fixed QuerySet.select_related() with multiple FilteredRelations. 2019-10-11 08:10:48 +02:00
Flavio Curella ed112fadc1 Fixed #23755 -- Added support for multiple field names in the no-cache Cache-Control directive to patch_cache_control().
https://tools.ietf.org/html/rfc7234#section-5.2.2.2
2019-10-10 19:30:51 +02:00
Flavio Curella 9facc90020 Refs #23755 -- Added tests for patch_cache_control() with no-cache Cache-Control directive. 2019-10-10 12:24:52 +02:00
Viktor Lomakin ee6b17187f Fixed #30812 -- Made ConditionalGetMiddleware set ETag only for responses with non-empty content. 2019-10-10 09:51:05 +02:00
Benjy Weinberger 3cd3bebe89 Fixed #30300 -- Allowed migrations to be loaded from directories without __init__.py file. 2019-10-10 08:31:41 +02:00
Simon Charette 26c66f4519 Fixed #30856 -- Combined fast-delete queries by model during cascade deletion.
Reduced the number of queries required when performing cascade deletion
for a model referenced multiple time by another one by performing an
union of reference lookups.
2019-10-09 09:49:53 +02:00
Hasan Ramezani a28d1b38e5 Fixed #30839 -- Fixed Field.__deepcopy__() so forms don't share error messages. 2019-10-08 10:07:05 +02:00
Hasan Ramezani 6452112640 Refs #27914 -- Fixed serialization of nested enum.Enum classes in migrations. 2019-10-03 08:39:30 +02:00
Hasan Ramezani d3030deaaa Refs #27914 -- Moved test enum.Enum subclasses outside of WriterTests.test_serialize_enums(). 2019-10-03 08:39:30 +02:00
Min ho Kim 103a6f4307 Fixed some typos in comments and docs.
Thanks to Mads Jenson for review.
2019-10-02 15:50:46 +02:00
Anatol Ulrich 8ed6788aa4 Fixed #30821 -- Added ExtractIsoWeekYear database function and iso_week_day lookup. 2019-10-02 10:41:34 +02:00
Tanner Stirrat 17595407ca Fixed #14218 -- Added Paginator.__iter__(). 2019-10-02 09:49:31 +02:00
ElizabethU 54ea290e5b Fixed #30651 -- Made __eq__() methods return NotImplemented for not implemented comparisons.
Changed __eq__ to return NotImplemented instead of False if compared to
an object of the same type, as is recommended by the Python data model
reference. Now these models can be compared to ANY (or other objects
with __eq__ overwritten) without returning False automatically.
2019-10-01 17:58:19 +02:00
Mariusz Felisiak 6475e6318c Refs #30651 -- Added tests for Prefetch.__eq__(). 2019-10-01 17:35:55 +02:00
Mariusz Felisiak 0d4b40fe66 Refs #30651 -- Added tests for Message.__eq__(). 2019-10-01 17:35:55 +02:00
Ahmet Kucuk dc890bef5a Fixed #30510 -- Fixed crash of QuerySet.bulk_create() with mixed-length texts on Oracle.
Text with more than 4000 characters must be set to as a CLOB on Oracle
what caused a mixed datatype error (ORA-01790) when shorter text
appeared in the same operation.
2019-10-01 12:38:58 +02:00
Ad Timmering 7b5f8acb9e Fixed #28690 -- Fixed handling of two-digit years in parse_http_date().
Due to RFC7231 ayear that appears to be more than 50 years in the
future are interpreted as representing the past.
2019-09-30 14:42:56 +02:00
Ad Timmering 7cbd25a06e Refs #28690 -- Added more tests for parse_http_date(). 2019-09-30 14:42:51 +02:00
Hasan Ramezani f0adf3b9b7 Fixed #30774 -- Made serialization in migrations use members names for Enums. 2019-09-30 10:28:05 +02:00
pablo fa8fe09e4e Fixed #30802 -- Prevented manifest creation when running collectstatic in dry run mode. 2019-09-27 23:01:41 +02:00
Hasan Ramezani 95a11578ce Fixed #30798 -- Fixed Meta.ordering validation for pk of related fields.
Regression in 440505cb2c.
2019-09-27 14:22:31 +02:00
Hasan Ramezani c7944628a1 Refs #30798 -- Prevented chaining fields from the same related model multiple times in model Meta.ordering. 2019-09-27 13:57:22 +02:00
Pablo García 2fd610eb30 Fixed #30810 -- Fixed WatchmanReloaderTests.test_setting_timeout_from_environment_variable test.
client_timeout is an instance attribute.
2019-09-27 08:09:05 +02:00
Oleg Kainov c574bec092 Fixed #25598 -- Added SCRIPT_NAME prefix to STATIC_URL and MEDIA_URL set to relative paths.
Thanks Florian Apolloner for reviews.

Co-authored-by: Joel Dunham <Joel.Dunham@technicalsafetybc.ca>
2019-09-25 19:47:03 +02:00
Mariusz Felisiak 580e644f24
Fixed #30800 -- Fixed migrations crash when altering a field with custom db_type().
Regression in 1378d665a1.
2019-09-25 12:32:24 +02:00
Maxim Kurnikov ff5dfbc63a Fixed false positive tests of Paginator.count property. 2019-09-25 09:15:18 +02:00
Mads Jensen 129583a0d3 Removed some outdated backwards compatibility imports and misleading comments.
EmptyResultSet moved in 46509cf13d.
FieldDoesNotExist moved in 8958170755.
BoundField and pretty_name moved in 8550161e53.
EMPTY_VALUES moved in 471596fc1a.
BaseRunserverCommand moved in 5c53e30607.
2019-09-24 15:18:53 +02:00
Mariusz Felisiak 01104368ff Refs #29444 -- Removed redundant DatabaseFeatures.can_return_multiple_columns_from_insert.
Unnecessary since b31e63879e.
2019-09-24 10:37:22 +02:00