Commit Graph

11392 Commits

Author SHA1 Message Date
Florian Apolloner 96a3ea39ef Fixed #31784 -- Fixed crash when sending emails on Python 3.6.11+, 3.7.8+, and 3.8.4+.
Fixed sending emails crash on email addresses with display names longer
then 75 chars on Python 3.6.11+, 3.7.8+, and 3.8.4+.

Wrapped display names were passed to email.headerregistry.Address()
what caused raising an exception because address parts cannot contain
CR or LF.

See https://bugs.python.org/issue39073

Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-07-20 07:10:40 +02:00
Mariusz Felisiak f405954ea2 Refs #31784 -- Added test for preventing header injection in display name of email addresses. 2020-07-20 07:10:16 +02:00
Mariusz Felisiak 3d16496037 Bumped asgiref requirement to >= 3.2.10.
Forwardported 3.1 release notes from 474f65406f.
2020-07-17 21:15:21 +02:00
Claudio Catterina faa6d41cda
Fixed typo in DecimalValidator tests.
This replaces redundant test for -Infinity with +Infinity.
2020-07-16 11:21:39 +02:00
Tim Park 8fa9a6d29e Fixed #31623 -- Allowed specifying number of adjacent time units in timesince()/timeuntil(). 2020-07-16 09:44:28 +02:00
Mariusz Felisiak 240cbb63bf
Fixed #31790 -- Fixed setting SameSite and Secure cookies flags in HttpResponse.delete_cookie().
Cookies with the "SameSite" flag set to None and without the "secure"
flag will be soon rejected by latest browser versions.

This affects sessions and messages cookies.
2020-07-16 08:16:58 +02:00
Simon Charette 156a2138db Refs #30446 -- Removed unnecessary Value(..., output_field) in docs and tests. 2020-07-15 10:58:38 +02:00
Simon Charette 1e38f1191d Fixed #30446 -- Resolved Value.output_field for stdlib types.
This required implementing a limited form of dynamic dispatch to combine
expressions with numerical output. Refs #26355 should eventually provide
a better interface for that.
2020-07-15 10:58:29 +02:00
Simon Charette 1b7623fdfd Refs #30446 -- Defined output_field of BoundingCircle() GIS database function.
This prevented the default behavior of
BaseExpression._resolve_output_field from error'ing out when such
functions accepted both expressions from mixed types
(e.g. BoundingCircle(Polygon, num_seg=12)).
2020-07-14 09:36:17 +02:00
Simon Charette 9c5c9bd709 Stopped adapting DecimalField values to strings on PostgreSQL.
The psycopg2 backend uses the type information to provide type hints.
2020-07-14 07:40:10 +02:00
Simon Charette f783a99072 Refs #25425 -- Allowed unresolved Value() instances to be compiled.
Previously unresolved Value() instances were only allowed to be
compiled if they weren't initialized with an output_field.

Given the usage of unresolved Value() instances is relatively common in
as_sql() overrides it's less controversial to add explicit support for
this previously undefined behavior now and revisit whether or not it
should be deprecated in the future.
2020-07-14 07:20:20 +02:00
Adam Johnson e906ff6fca Fixed #30457 -- Added TestCase.captureOnCommitCallbacks(). 2020-07-13 11:56:46 +02:00
Tom Forbes f36862b69c Fixed #31674 -- Made technical 500 debug page respect __suppress_context__. 2020-07-13 08:06:21 +02:00
ovkulkarni b7a438c7e2 Fixed #31509 -- Made DiscoverRunner enable faulthandler by default. 2020-07-10 18:55:50 +02:00
Claude Paroz 00727d384b Refs #30578 -- Made SelectDateWidget.format_value() independent of USE_L10N. 2020-07-10 13:00:37 +02:00
François Freitag 04e4f80c1f Sorted conflicting migrations by names. 2020-07-10 12:18:42 +02:00
matt ferrante 7d6916e827 Fixed #29789 -- Added support for nested relations to FilteredRelation. 2020-07-09 20:24:00 +02:00
Jon Dufresne 5a3d7cf462
Used urllib.parse.urljoin() in auth_tests to join URLs.
As the strings represent URLs and not paths, should use urllib to
manipulate them.
2020-07-09 12:03:03 +02:00
Mariusz Felisiak 8a6df55f2d
Fixed #31773 -- Fixed preserving output_field in ExpressionWrapper for combined expressions.
Thanks Thodoris Sotiropoulos for the report and Simon Charette for the
implementation idea.

Regression in df32fd42b8.
2020-07-09 11:55:03 +02:00
Jon Dufresne 0e6fa65ffd Refs #30400 -- Improved typography in debug and csrf templates. 2020-07-08 22:04:37 +02:00
davidchorpash 779e615e36 Fixed #31573 -- Made QuerySet.update() respect ordering on MariaDB/MySQL. 2020-07-08 11:43:50 +02:00
Mariusz Felisiak ae8338daf3
Fixed #31767 -- Fixed QuerySet.none() on combined queryset. 2020-07-07 12:15:05 +02:00
rico-ci cb0da637a6 Fixed #31713 -- Added SpatialReference support to GDALRaster.transform(). 2020-07-07 09:26:44 +02:00
Hasan Ramezani 7af8f41273 Refs #26445 -- Allowed using UserManager.create_user()/create_superuser() in migrations.
Used app config to lookup user model in _create_user().

Thanks Markus Holtermann for the review and initial patch.
Thanks Simon Charette for the implementation idea.
2020-07-06 11:47:22 +02:00
Jacob Walls 512da9d585 Fixed #23797 -- Fixed QuerySet.exclude() when rhs is a nullable column. 2020-07-06 10:15:37 +02:00
Hasan Ramezani b7b7df5fbc Fixed #31530 -- Added system checks for invalid model field names in CheckConstraint.check and UniqueConstraint.condition. 2020-07-06 09:16:57 +02:00
Sergey Fedoseev 9d519d3dc4 Fixed #31755 -- Made temporal subtraction resolve output field. 2020-07-01 23:02:27 +02:00
Sergey Fedoseev ed6b14d459
Refs #28621 -- Fixed crash of annotations with nested OuterRef. 2020-07-01 11:01:46 +02:00
Carlton Gibson b5371539a9
Fixed #31752 -- Fixed intermittent test_order_by_relational_field_through_model failure.
Set explicit datetime for M2M ordering test.

Thanks to Mariusz Felisiak for the suggestion.
2020-06-30 13:08:23 +02:00
Sergey Fedoseev dd5aa8cb5f Fixed #28925 -- Fixed durations-only expressions crash on SQLite and MySQL.
This removes also unused DatabaseOperations.date_interval_sql().
2020-06-30 07:04:55 +02:00
Ad Timmering ec5aa2161d
Fixed #30807 -- Fixed TestArchive.test_extract_file_permissions() when umask is 0o000.
Fixed test that checks permissions on files extracted from archives
with no permissions set, to not assume a default umask of 0o002.

Test regression in c95d063e77.
2020-06-29 07:51:43 +02:00
Hannes Ljungberg 30e3d2d78d
Fixed #31745 -- Added error messages when using UniqueConstraint.include/opclasses with deferrable. 2020-06-29 06:41:23 +02:00
Mariusz Felisiak 62d85a2835
Fixed #31742 -- Fixed makemigrations crash on ForeignKey to an app with mixed case label.
Regression in 9e1b6b8a66.

Thanks Ignacio Santolin for the report.
2020-06-26 23:18:59 +02:00
Mariusz Felisiak 09914ccf68
Fixed test_clean_does_deduplicate_values on Oracle after e13cfc6dfd. 2020-06-26 22:37:58 +02:00
Hasan Ramezani 8984cab8a8 Fixed #31620 -- Added support for %V format to WeekMixin/WeekArchiveView.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-06-26 11:12:57 +02:00
Jon Dufresne feb6581993
Fixed the centering of the "Log in" button on admin login page.
Previously, the button's container had a padding of 9.4em which was
approximately center but not precisely. Now, the container uses
'align:text-center' to let the browser center the button.
2020-06-26 06:59:33 +02:00
Jon Dufresne 60db8b7b37 Removed unnecessary admin CSS.
The "object-tools" container is never rendered as a descendant of
.form-row.

The "golink" CSS class is unused.

A <label> element has not been included in the login .submit-row since
5869afe32b.

The "help" CSS class from login.css has been unused since
0e5faf225c.

The <label> color in login.css is already inherited from the <body>
element and so does not need to be re-specified.

The #content-main container already has the property 'width: 100%' from
base.css and so does not need to be re-specified in login.css.

The <td> and <th> font-family property is inherited from the <body>
element and so does not need to be re-specified.

The <html> element has the attribute dir which automatically sets
the text direction in the layout. Adding the direction CSS property was
necessary to support IE which does not support the dir attribute, but IE
is no longer supported, so drop the direction property.

The 'font-size: 1em' property re-specifies the same font size. It
creates no visual difference.

The 'font-size: 14px' property often re-specifies the inherited value.
Avoid re-specifying it.
2020-06-25 11:46:05 +02:00
Jon Dufresne e13cfc6dfd Fixed #31596 -- Changed ForeignKey.validate() to use the base manager. 2020-06-25 11:36:20 +02:00
Mariusz Felisiak 1e96de4f97
Added test for django.contrib.admin.utils.help_text_for_field(). 2020-06-25 11:23:26 +02:00
Hasan Ramezani fbe82f8255 Refs #26761 -- Removed extra space in admin change list result header. 2020-06-25 06:33:12 +02:00
Simon Charette 5227101787 Defined output_field of Func() in test_grouping_by_annotations_with_array_field_param().
output_field cannot be automatically determined because the first
argument passed to ARRAY_LEN is an ArrayField and the second one is an
integer.
2020-06-24 12:26:36 +02:00
Nick Pope 074844e947 Fixed #31529 -- Added support for serialization of pathlib.Path/PurePath and os.PathLike in migrations. 2020-06-24 11:45:34 +02:00
David Smith 162765d6c3 Fixed #9061 -- Allowed FormSets to disable deleting extra forms.
Thanks to Dan Ward for the initial patch.
2020-06-24 09:26:25 +02:00
Simon Charette 2e8941b6f9 Fixed #31735 -- Fixed migrations crash on namespaced inline FK addition on PostgreSQL.
The namespace of the constraint must be included when making the
constraint immediate.

Regression in 22ce5d0031.

Thanks Rodrigo Estevao for the report.
2020-06-24 08:37:20 +02:00
Jon Dufresne 6f3e3e87ab Fixed #31703 -- Made makemigrations name all initial migrations "initial".
When the MigrationAutodetector creates more than one initial migration
in a app, name all initial migrations "initial" rather than the opaque
"auto_<DATE>_<TIME>" name.

Initial migrations that have a descriptive name continue to use the
descriptive name.
2020-06-24 07:18:45 +02:00
Jon Dufresne 01195c4a83 Refs #31703 -- Added Migration.suggest_name() test for initial migration with multiple CreateModels. 2020-06-24 07:18:38 +02:00
Jon Dufresne bce180dd05 Refs #31703 -- Moved MigrationAutodetector.suggest_name() to Migration.
Allows expanding the method to inspect additional attributes of the
migration instance. For example, the Migration.initial attribute.
2020-06-24 07:01:11 +02:00
Ahmad A. Hussein 798835112d Fixed #31736 -- Fixed InspectDBTransactionalTests.test_foreign_data_wrapper crash on Windows. 2020-06-23 20:26:43 +02:00
Frantisek Holop cc7c16af98 Fixed #31443 -- Fixed login redirection in auth mixins when LOGIN_URL is off-site URL. 2020-06-23 10:38:35 +02:00
Jon Moroney 136ec9b62b Refs #31358 -- Added decode() to password hashers.
By convention a hasher which does not use a salt should populate the
decode dict with `None` rather than omit the dict key.

Co-Authored-By: Florian Apolloner <apollo13@users.noreply.github.com>
2020-06-23 08:36:59 +02:00
Adam Johnson 6e5041f57c
Removed unused param_dict return from URLResolver.resolve_error_handler().
Unused since its introduction in ed114e1510.
2020-06-22 21:28:56 +02:00
Claude Paroz 258c88a913 Refs #5691 -- Made cache keys independent of USE_L10N.
This mostly reverts af1893c4ff.
2020-06-22 10:55:12 +02:00
Adam Johnson e37f809618 Combined MySQL backend server info queries. 2020-06-22 09:58:46 +02:00
Claude Paroz e62d55a4fe Fixed #31692 -- Prevented unneeded .po file compilation.
Thanks Nick Pope and Simon Charette for the reviews.
2020-06-22 08:44:16 +02:00
Claude Paroz ed0a040773 Refs #31692 -- Updated compilemessages and tests to use pathlib. 2020-06-22 08:33:00 +02:00
Guillermo Bonvehí f386454d13 Fixed #31728 -- Fixed cache culling when no key is found for deletion.
DatabaseCache._cull implementation could fail if no key was found to
perform a deletion in the table. This prevented the new cache key/value
from being correctly added.
2020-06-22 06:29:35 +02:00
David Smith 27c09043da Refs #31670 -- Renamed whitelist argument and attribute of EmailValidator. 2020-06-18 21:43:20 +02:00
Alix 26a413507a Fixed #6933 -- Added support for searching against quoted phrases in ModelAdmin.search_fields. 2020-06-18 20:17:20 +02:00
Tom Forbes 8a902b7ee6
Fixed #31716 -- Fixed detection of console scripts in autoreloader on Windows. 2020-06-18 13:04:10 +02:00
David Smith 10df5b7177
Refs #31670 -- Removed whitelist/blacklist terminology in docs and comments. 2020-06-17 13:15:56 +02:00
Hasan Ramezani 47651eadb8 Fixed #30583 -- Fixed handling JSONFields in XML serializer.
Co-authored-by: Chason Chaffin <chason@gmail.com>
2020-06-17 11:12:18 +02:00
Mariusz Felisiak 82da72b748
Refs #28077 -- Added opclasses to Index.__repr__().
This also removes unnecessary commas between attributes.
2020-06-17 10:32:43 +02:00
Florian Apolloner 1621f06051 Fixed #30472 -- Made Argon2PasswordHasher use Argon2id. 2020-06-17 08:10:41 +02:00
Florian Apolloner ee49cf4f35 Added test for old Argon2i hashes with version attribute. 2020-06-17 08:10:41 +02:00
Mariusz Felisiak 78c811334c
Refs #30190 -- Minor edits to JSONL serializer.
Follow up to e29637681b.
2020-06-17 07:59:40 +02:00
Mariusz Felisiak e36028fb9c
Reverted "Pinned asgiref == 3.2.7 in test requirements."
This reverts commit dcb4d79ef7.
2020-06-17 07:08:51 +02:00
Ali Vakilzade e29637681b
Fixed #30190 -- Added JSONL serializer. 2020-06-16 16:51:58 +02:00
Simon Charette ea3beb4f5a Refs #30446 -- Defined default output_field of text database functions.
This prevented the default behavior of
BaseExpression._resolve_output_field from error'ing out when such
functions accepted both expressions from mixed types
(e.g. SubStr(CharField, IntegerField, IntegerField)).
2020-06-16 10:08:02 +02:00
Hannes Ljungberg 0d6d4e78b1 Fixed #31709 -- Added support for opclasses in ExclusionConstraint. 2020-06-16 08:16:14 +02:00
Mariusz Felisiak dcb4d79ef7
Pinned asgiref == 3.2.7 in test requirements. 2020-06-16 07:54:41 +02:00
Hannes Ljungberg 7edc6e53a7 Fixed #31702 -- Added support for PostgreSQL opclasses in UniqueConstraint. 2020-06-16 07:19:00 +02:00
John Parton a8473b4d34 Fixed #31691 -- Added ordering support to JSONBAgg. 2020-06-13 00:06:29 +02:00
Hannes Ljungberg e0cdd0fcf5 Fixed #31649 -- Added support for covering exclusion constraints on PostgreSQL 12+. 2020-06-12 23:23:21 +02:00
Hasan Ramezani 9e8edc1e55 Fixed #31491 -- Allowed 'password' option in DATABASES['OPTIONS'] on MySQL. 2020-06-12 12:07:43 +02:00
Chinmoy Chakraborty 2928019e0c Fixed #31645 -- Enhanced the migration warning for migrate commmand.
Added the list of apps with changes not reflected in migrations.
2020-06-12 10:26:06 +02:00
Mariusz Felisiak aeb8996a67 Fixed #31659 -- Made ExpressionWrapper preserve output_field for combined expressions.
Regression in df32fd42b8.

Thanks Simon Charette for the review.
2020-06-12 07:20:06 +02:00
Adam Johnson 5776a1660e Fixed #31667 -- Made __in lookup ignore None values. 2020-06-11 12:12:26 +02:00
Michael Brown 36db4dd937 Fixed #28132 -- Made MultiPartParser ignore filenames with trailing slash. 2020-06-11 08:46:59 +02:00
Hasan Ramezani 037a624120 Fixed #31657 -- Fixed ordering by attnames of self-referential ForeignKeys. 2020-06-10 11:14:26 +02:00
Hasan Ramezani c1f7de8acc Refs #31657 -- Added test for ordering by self-referential ForeignKeys. 2020-06-10 11:11:20 +02:00
Hasan Ramezani a59de6e89e Fixed #31675 -- Added warning to ExceptionReporter when exception chain has a cycle. 2020-06-10 09:23:33 +02:00
Joshua Massover 92309e53d9 Fixed #31594 -- Added ASGIStaticFilesHandler.get_response_async(). 2020-06-08 12:52:26 +02:00
Nicolas Baccelli b38d44229f Fixed #31664 -- Reallowed using non-expressions having filterable attribute as rhs in queryset filters.
Regression in 4edad1ddf6.
2020-06-08 08:17:23 +02:00
Mariusz Felisiak 78ad4b4b02
Fixed #31660 -- Fixed queryset crash when grouping by m2o relation.
Regression in 3a941230c8.

Thanks Tomasz Szymański for the report.
2020-06-08 07:21:54 +02:00
davidchorpash 07506a6114 Fixed #31661 -- Removed period in makemigrations history check warning. 2020-06-08 06:46:23 +02:00
Sasha Pachev 38a21f2d9e
Fixed #31663 -- Made DecimalField.to_python() handle non-numeric invalid values. 2020-06-05 21:13:36 +02:00
David Smith 433dd737f9 Fixed #20347 -- Allowed customizing the maximum number of instantiated forms in formsets.
Co-authored-by: ethurgood <ethurgood@gmail.com>
2020-06-05 12:01:32 +02:00
David Smith b5aa9cb20f Refs #20347 -- Added test for formset_factory()'s absolute_max default.
Co-authored-by: ethurgood <ethurgood@gmail.com>
2020-06-05 10:00:25 +02:00
Mariusz Felisiak 926148ef01
Fixed #31654 -- Fixed cache key validation messages. 2020-06-05 07:21:52 +02:00
Mariusz Felisiak f83b44075d Refs #30913 -- Added system checks for covering indexes and unique constraints support. 2020-06-04 12:26:25 +02:00
Hannes Ljungberg 8c7992f658 Fixed #30913 -- Added support for covering indexes on PostgreSQL 11+. 2020-06-04 12:26:22 +02:00
Jon Dufresne f47d5aac62
Refs #27804 -- Used subTest() in tests.utils_tests.test_text. 2020-06-04 11:16:21 +02:00
Claude Paroz 9e57b1efb5 Fixed #30134 -- Ensured unlocalized numbers are string representation in templates. 2020-06-04 10:34:54 +02:00
Claude Paroz 51250d2f12 Refs #30134 -- Added test for {% localize off %} tag with format settings. 2020-06-04 10:34:54 +02:00
Tim Graham a7b4a04d6c Refs #31630 -- Added CharField and IntegerField to DatabaseFeatures.introspected_field_types.
CockroachDB introspects CharField as TextField and IntegerField as
BigIntegerField.
2020-06-04 08:46:06 +02:00
Tim Graham e24b63fe85 Refs #31630 -- Removed DatabaseFeatures.can_introspect_autofield. 2020-06-04 08:27:46 +02:00
Hasan Ramezani e198beadad Fixed #31630 -- Replaced introspection features with DatabaseFeatures.introspected_field_types. 2020-06-04 08:27:42 +02:00
David Smith dbdc192ca3 Preferred usage of among/while to amongst/whilst. 2020-06-03 21:02:48 +02:00
Mariusz Felisiak 229c9c6653 Refs CVE-2020-13254 -- Fixed cache.tests when KEY_PREFIX is defined.
Follow up to 2c82414914.
2020-06-03 13:00:37 +02:00
Dan Palmer 2c82414914 Fixed CVE-2020-13254 -- Enforced cache key validation in memcached backends. 2020-06-03 09:24:26 +02:00
Jon Dufresne 2dd4d110c1 Fixed CVE-2020-13596 -- Fixed potential XSS in admin ForeignKeyRawIdWidget. 2020-06-03 09:23:00 +02:00
Thodoris Sotiropoulos df32fd42b8 Fixed #31651 -- Made ExpressionWrapper use grouping columns from wrapped expression. 2020-06-03 07:29:41 +02:00
Adam Johnson 22a59c01c0 Refs #31615 -- Added EXISTS clauses to extension operations. 2020-06-03 07:02:48 +02:00
Carles Pina e46c2326c8 Fixed #31536 -- Fixed rendering of disabled AdminFileWidget and ClearableFileInput. 2020-06-01 12:25:25 +02:00
René Fleschenberg 578b3046e3 Reverted "Refs #23919 -- Removed obsolete __init__.py files in management command directories."
This reverts commit ccc25bfe4f.

https://groups.google.com/d/topic/django-developers/GVHMH2ciAnk/discussion
2020-06-01 10:55:41 +02:00
Carlton Gibson dd1ca50b09 Fixed #31570 -- Corrected translation loading for apps providing territorial language variants with different plural equations.
Regression in e3e48b0012.

Thanks to Shai Berger for report, reproduce and suggested fix.
2020-06-01 08:38:54 +02:00
David Smith 0382ecfe02 Fixed #28694 -- Made django.utils.text.slugify() strip dashes and underscores. 2020-05-29 06:47:51 +02:00
David Smith dde05e192c Added more tests for slugify(). 2020-05-29 06:28:57 +02:00
Adam Johnson fa58450a9a Fixed #31468 -- Allowed specifying migration filename in Operation.
This adds also suggested filename for many built-in operations.
2020-05-28 11:42:53 +02:00
Adam Johnson 5bd585a82d Refs #31468 -- Added tests for MigrationAutodetector.suggest_name(). 2020-05-28 11:24:58 +02:00
Tom Carrick 780473d756 Refs #31034 -- Improved accessibility of admin navigation sidebar. 2020-05-28 10:16:20 +02:00
Mariusz Felisiak 42de52affe
Fixed isolation of test_migrate_fake_initial. 2020-05-28 09:32:43 +02:00
Scott Cranfill 62f1655a64 Fixed #11157 -- Stopped removing stop words in admin's prepopulated_fields.
Co-Authored-By: Andy Chosak <andy@chosak.org>
2020-05-27 12:32:56 +02:00
Frantisek Holop d693a086de Fixed #31615 -- Made migrations skip extension operations if not needed.
- Don't try to create an existing extension.
- Don't try to drop a nonexistent extension.
2020-05-27 10:48:44 +02:00
Frantisek Holop 73216aaaa9 Used not installed extension in CreateExtension() tests.
uuid-ossp was already installed.
2020-05-27 10:46:22 +02:00
Ahmad A. Hussein 7c947f0f5a Fixed #31494 -- Preserved query strings when following HTTP 307/308 redirects in test client. 2020-05-27 10:36:52 +02:00
Ahmad A. Hussein 6425fd3124 Refs #31494 -- Added test for query strings for GET/HEAD requests when following HTTP 307/308 redirects in test client. 2020-05-27 10:36:52 +02:00
Mariusz Felisiak f4bab0982a Refs #31614 -- Added test for ordering by OrderBy() of combined queryset with not selected columns. 2020-05-27 09:03:53 +02:00
Ryan Heard 587b179d41 Fixed #31606 -- Allowed using condition with lookups in When() expression. 2020-05-27 07:32:23 +02:00
Laurent Tramoy 2aac176e86 Fixed #31614 -- Fixed aliases ordering by OrderBy() expressions of combined queryset. 2020-05-26 21:14:45 +02:00
Laurent Tramoy 51ad767d0b Refs #31614 -- Added test for aliases ordering on combined querysets. 2020-05-26 21:14:40 +02:00
Laurent Tramoy 50f71ccb36 Used operator.attrgetter() in test_qs_combinators. 2020-05-26 21:14:40 +02:00
Nan Liu 33c365781a Fixed #31416 -- Made autodetector find dependencies for MTI model creation on base fields removal.
Removing a base field must take place before adding a new inherited
model that has a field with the same name.
2020-05-26 07:26:07 +02:00
Hasan Ramezani 18759b2209 Fixed #31616 -- Added hint about middleware ordering for SessionMiddleware admin check. 2020-05-25 21:14:32 +02:00
Claude Paroz adf58311b8 Fixed #29078 -- Made serializers respect prefetch_related() for m2m fields. 2020-05-25 10:45:16 +02:00
Claude Paroz b547c42661 Improved HTTPSitemapTests.test_localized_priority.
Override setting instead of skipping.
Use translation override context manager to avoid language leaking.
2020-05-25 09:07:50 +02:00
Simon Charette 972000420e Fixed #31624 -- Avoided subquery usage on QuerySet.all().delete().
Thanks Adam Johnson for the report.

Regression in 7acef095d7.
2020-05-25 08:14:49 +02:00
Jon Dufresne dfb9ae1d23 Refs #30400 -- Improved typography in admin_doc/missing_docutils.html. 2020-05-23 12:02:10 +02:00
Hasan Ramezani c60524c658 Fixed #31546 -- Allowed specifying list of tags in Command.requires_system_checks. 2020-05-21 12:34:54 +02:00
Manuel Weitzman a4e6030904 Fixed #30375 -- Added FOR NO KEY UPDATE support to QuerySet.select_for_update() on PostgreSQL. 2020-05-21 10:51:10 +02:00
Jon Dufresne 81d69568a6 Made test_once a keyword argument in template_tests.utils.setup().
Replaces the kwargs.get(...) pattern. Helps avoid typos by providing a
better error message in case of misuse.
2020-05-21 08:09:19 +02:00
Fran Hrzenjak 4484bc1b2f Fixed #31597, #31603 -- Corrected admin clear all filters link behavior.
- Show "Clear all filters" only when any filter is selected.
- Preserve query string not related with filters.

Co-Authored-By: Hasan Ramezani <hasan.r67@gmail.com>
2020-05-20 21:08:47 +02:00
Hasan Ramezani 3c7bf39e23 Fixed #31410 -- Added system checks for invalid model field names in UniqueConstraint. 2020-05-20 10:56:55 +02:00
David Smith e875fac886
Removed unused variable in test_datetimefield_clean_input_formats. 2020-05-20 06:02:28 +02:00
Mariusz Felisiak a125da6a7c Fixed #31607 -- Fixed evaluated Subquery equality.
Regression in 691def10a0.
2020-05-19 22:44:57 +02:00
Mariusz Felisiak b739f2e91d Refs #30727 -- Added tests for Subquery with queryset in kwargs pickle without evaluating it. 2020-05-19 22:44:57 +02:00
Mariusz Felisiak 20a8a443f0
Fixed #31578 -- Dropped support for MySQL 5.6. 2020-05-19 10:56:39 +02:00
wtkm11 9756c33429 Fixed #31504 -- Allowed calling makemigrations without an active database connection. 2020-05-19 10:24:23 +02:00
Hannes Ljungberg 952afc166c Fixed #31601 -- Fixed SearchHeadlineTests on PostgresSQL 9.6.18+, 10.13+, 11.8+, and 12.3+. 2020-05-19 07:46:22 +02:00
Jon Dufresne 3b1cb78063
Used assertIs(…, True) in model_forms.tests.ValidationTest. 2020-05-18 09:25:26 +02:00
Jon Dufresne 7070d46114 Updated docutils link to HTTPS and new location. 2020-05-18 08:45:31 +02:00
Tim Graham f59a2b7306
Refs #12990 -- Added DatabaseFeatures.has_json_operators.
CockroachDB also has them.
2020-05-18 08:12:20 +02:00
Simon Charette 94f63b926f Refs #31395 -- Relied on setUpTestData() test data isolation in various tests. 2020-05-15 20:22:56 +02:00
Simon Charette 3cf80d3fcf Fixed #31395 -- Made setUpTestData enforce in-memory data isolation.
Since it's introduction in Django 1.8 setUpTestData has been suffering
from a documented but confusing caveat due to its sharing of attributes
assigned during its execution with all test instances.

By keeping track of class attributes assigned during the setUpTestData
phase its possible to ensure only deep copies are provided to test
instances on attribute retreival and prevent manual setUp gymnastic to
work around the previous lack of in-memory data isolation.

Thanks Adam Johnson for the extensive review.
2020-05-15 20:22:52 +02:00
Simon Charette 1dd96f731d Refs #13227 -- Adjusted a test to avoid making a shared test model unpickable.
This allowed the Note model to be used in setUpTestData() which requires
assigned model instances to be copy.deepcopy()'able.
2020-05-15 20:22:51 +02:00
Paolo Melchiorre 0e3b0da2e3 Fixed #31552 -- Added support for LZMA and XZ fixtures to loaddata. 2020-05-15 11:30:28 +02:00
François Freitag 2e48cf6bd9 Fixed fixtures loading isolation in tests.
fixture1.json and fixture2.json exist in both "fixtures" and
"fixtures_model_package". Both apps are listed in "INSTALLED_APPS". The
loaddata management command loads from installed apps, thus loads both
fixtures when a test runs loaddata with any of these fixtures.
2020-05-15 09:14:05 +02:00
kjpc-tech 099bce1bf0 Fixed #31590 -- Fixed ModelAdmin.date_hierarchy crash with an empty QuerySet.
Regression in 55cdf6c52d.
2020-05-15 06:35:10 +02:00
Jon Dufresne 81ffedaacc Fixed #31524 -- Removed minified static assets from the admin. 2020-05-14 16:07:56 +02:00
Carlton Gibson 6c19c2ca51 Corrected indentation in test case. 2020-05-14 15:32:36 +02:00
Jon Dufresne 129193328e Added Selenium test coverage for actions.js. 2020-05-14 15:32:36 +02:00
Mariusz Felisiak 3a941230c8
Fixed #31584 -- Fixed crash when chaining values()/values_list() after Exists() annotation and aggregation on Oracle.
Oracle requires the EXISTS expression to be wrapped in a CASE WHEN in
the GROUP BY clause.

Regression in efa1908f66.
2020-05-14 15:07:08 +02:00
David Smith 03537e2458
Completed lorem tag test coverage. 2020-05-14 12:36:38 +02:00
Jon Dufresne d522b51c40 Fixed #31575 -- Added system check for admin sidebar request context processor dependency.
Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
2020-05-14 11:00:51 +02:00
Simon Charette adfbf653dc Fixed #31568 -- Fixed alias reference when aggregating over multiple subqueries.
691def10a0 made all Subquery() instances
equal to each other which broke aggregation subquery pushdown which
relied on object equality to determine which alias it should select.

Subquery.__eq__() will be fixed in an another commit but
Query.rewrite_cols() should haved used object identity from the start.

Refs #30727, #30188.

Thanks Makina Corpus for the report.
2020-05-14 09:31:15 +02:00
Simon Charette 42c08ee465 Fixed #31566 -- Fixed aliases crash when chaining values()/values_list() after annotate() with aggregations and subqueries.
Subquery annotation references must be resolved if they are excluded
from the GROUP BY clause by a following .values() call.

Regression in fb3f034f1c.

Thanks Makina Corpus for the report.
2020-05-14 08:16:16 +02:00
Mariusz Felisiak e536fa5ce1
Fixed #31579 -- Dropped support for PostgreSQL 9.5 and PostGIS 2.2. 2020-05-14 06:33:00 +02:00
Mariusz Felisiak 18eb852874
Fixed #31576 -- Fixed selenium tests with headless mode.
Horizontal scrollbar doesn't appear with the headless mode on small
windows, that's why window.scrollTo() is not an option for these
tests.

Tests changed after adding a navigation sidebar in
46fe506445.
2020-05-13 15:07:21 +02:00
Hasan Ramezani 01a381cc17
Fixed #31580 -- Added error messages on distinct() following union(), intersection(), and difference(). 2020-05-13 14:44:10 +02:00
François Freitag 49ae7ce50a
Removed redundant assertions in fixtures tests. 2020-05-13 13:07:15 +02:00
Claude Paroz d4c5ef3ebb Renamed PROJ.4 to PROJ. 2020-05-13 10:30:30 +02:00
François Freitag f9d13a1b5a
Removed unused fixture2.xml from fixtures_model_package tests. 2020-05-13 09:13:02 +02:00
François Freitag c8bebbd541
Disabled management commands output with verbosity 0 in various tests. 2020-05-13 09:12:43 +02:00
Mariusz Felisiak f2187a227f Increased the default PBKDF2 iterations for Django 3.2. 2020-05-13 09:07:51 +02:00
Mariusz Felisiak d106d07f73 Advanced deprecation warnings for Django 3.2. 2020-05-13 09:07:51 +02:00
Claude Paroz 58f1b07e49 Fixed #30678 -- Added support for GDAL 3. 2020-05-12 09:06:06 +02:00
Mariusz Felisiak 0668164b4a
Fixed E128, E741 flake8 warnings. 2020-05-12 08:52:23 +02:00
Tom Carrick d24ba1be7a Fixed #31034 -- Added a navigation sidebar to the admin.
Co-authored-by: elky <elky@users.noreply.github.com>
Co-authored-by: Goetz <goetz.buerkle@gmail.com>
2020-05-11 18:16:38 +02:00
Jon Dufresne d6aff369ad Refs #30116 -- Simplified regex match group access with Match.__getitem__().
The method has been available since Python 3.6. The shorter syntax is
also marginally faster.
2020-05-11 12:01:28 +02:00
Adam Johnson a8b2db1cae Optimized Model and QuerySet pickling version comparison. 2020-05-11 09:50:11 +02:00
Jon Dufresne 72a170b4c3 Fixed #25236 -- Deprecated {% ifequal %} and {% ifnotequal %} template tags.
The {% if %} tag provides all features of these tags.

Since Django 1.2 (May 17, 2010), the docs have hinted that
{% ifequal %} and {% ifnotequal %} will be deprecated in a future
Django version. Time to make it official.
2020-05-11 09:07:33 +02:00
Jon Dufresne d8cb8fdf40 Switched unittest.TestCase to SimpleTestCase in template_tests/test_nodelist.py. 2020-05-11 07:56:11 +02:00
Yash Saini ccb1cfb64e Fixed #31548 -- Fixed URLValidator crash on non-strings. 2020-05-08 20:53:05 +02:00
Yash Saini bda6ade7b7 Added URLValidator test for missing scheme. 2020-05-08 20:50:25 +02:00
Hasan Ramezani 87faeee4e0 Fixed #31528 -- Made collectstatic management command run staticfiles checks. 2020-05-08 12:47:57 +02:00
François Freitag 01f8d19ef9 Fixed tests isolation in logging_tests.
The SetupConfigureLogging test case does not restore the logging config
after its execution. It leaves the logger django.request with an empty
handlers array.

This also removes the last use of LOGGING_CONFIG, introduced in
43503b093a.
2020-05-08 10:49:34 +02:00
dbxnr fc0f7f6c15 Fixed #31157 -- Fixed displaying read-only JSONField values in admin. 2020-05-08 09:44:42 +02:00
dbxnr 675ce4dd35 Refs #31157 -- Added tests for display_for_field() with empty JSONField. 2020-05-08 09:37:49 +02:00
Paolo Melchiorre 2e0f04507b Added tests for loaddata with gzip/bzip2 compressed fixtures.
Co-authored-by: Adam Johnson <me@adamj.eu>
2020-05-08 08:16:50 +02:00
sage 6789ded0a6 Fixed #12990, Refs #27694 -- Added JSONField model field.
Thanks to Adam Johnson, Carlton Gibson, Mariusz Felisiak, and Raphael
Michel for mentoring this Google Summer of Code 2019 project and
everyone else who helped with the patch.

Special thanks to Mads Jensen, Nick Pope, and Simon Charette for
extensive reviews.

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-05-08 07:23:31 +02:00
Mariusz Felisiak f97f71f592 Refs #12990 -- Bumped mysqlclient requirement to >= 1.4.0.
MySQLdb.constants.FIELD_TYPE.JSON was added in mysqlclient 1.4.0rc2.
2020-05-08 06:14:42 +02:00
Mariusz Felisiak 106e8dc91a
Completed test coverage for ExclusionConstraint.
Dropping exclusion constraints was untested.
2020-05-07 10:02:14 +02:00
Carlton Gibson 92507bf3ea Fixed #31515 -- Made ASGIHandler dispatch lifecycle signals with thread sensitive. 2020-05-06 09:42:02 +02:00
Adam Johnson 1c2c6f1b51
Fixed a/an typos in "SQL" usage. 2020-05-06 06:35:26 +02:00
Mariusz Felisiak fb52176a6f Made DateTimePickerShortcutsSeleniumTests.test_date_time_picker_shortcuts() less flaky.
Moved picking the current time closer to the actual click.
2020-05-05 11:00:05 +02:00
Mariusz Felisiak b73e66e758
Fixed #31538 -- Fixed Meta.ordering validation lookups that are not transforms.
Regression in 440505cb2c.

Thanks Simon Meers for the report.
2020-05-05 09:08:29 +02:00
David Smith 2522559d1a Fixed #31534 -- Deprecated django.conf.urls.url(). 2020-05-05 07:34:34 +02:00
Adam Johnson d17b380653 Refs #30573 -- Rephrased "Of Course" and "Obvious(ly)" in documentation and comments. 2020-05-04 12:10:47 +02:00
Rasmus Wriedt Larsen f6d0bd208a
Corrected opts argument of colorize in TermColorTests.test_colorize_empty_text(). 2020-05-04 11:34:08 +02:00
Tom Forbes c00bc27945 Refs #30372 -- Stopped watching built-in Django translation files by auto-reloader. 2020-05-04 09:13:47 +02:00
Nick Pope 8f10ceaa90 Changed `'%s' % value` pattern to `str(value)`. 2020-05-04 08:27:18 +02:00
François Freitag a0df5dea33
Removed unnecessary inner methods in CreatesuperuserManagementCommandTestCase. 2020-05-01 20:51:44 +02:00
Ian Foote b4068bc656 Fixed #31455 -- Added support for deferrable exclusion constraints on PostgreSQL. 2020-05-01 09:08:36 +02:00
Ian Foote c226c6cb32 Fixed #20581 -- Added support for deferrable unique constraints. 2020-04-30 10:43:50 +02:00
Mariusz Felisiak 555e3a848e
Removed unused __str__() methods in tests models.
Follow up to 6461583b6c.
2020-04-30 09:13:23 +02:00
Hasan Ramezani f121621073 Fixed #31521 -- Skipped test_parsing_rfc850 test on 32-bit systems. 2020-04-30 06:51:47 +02:00
Mariusz Felisiak 54646a423b
Refs #27468 -- Made user sessions use SHA-256 algorithm. 2020-04-29 16:45:00 +02:00
Jon Dufresne 0dafadadb9 Refs #30400 -- Improved typography of user facing strings in admin changelist. 2020-04-29 07:01:46 +02:00
Jon Dufresne bdff97d373 Added tests for saving with pending actions in admin changelist. 2020-04-29 07:01:41 +02:00
Hasan Ramezani 68fc21b378 Fixed #29249 -- Made JSON and YAML serializers use Unicode by default. 2020-04-28 11:11:39 +02:00
Hasan Ramezani 8970bb4cfd Refs #29249 -- Added tests for serializing Unicode data with XML serializer. 2020-04-28 11:11:39 +02:00
François Freitag 9ef4a18dbe Changed django.forms.ValidationError imports to django.core.exceptions.ValidationError.
Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-04-28 10:49:00 +02:00
Richard Campen 67b334fbaf Fixed #31517 -- Fixed HashedFilesMixin.hashed_name() if hash of the file is None. 2020-04-28 08:25:07 +02:00
François Freitag f19bb54fb1 Added test for squashmigrations' output. 2020-04-28 06:32:43 +02:00
François Freitag abea86f9e4 Removed unnecessary tuple wrapping of single format string argument. 2020-04-27 08:30:16 +02:00
François Freitag 687cb38a05 Removed unnecessary capturing/hiding of stdout/stderr in various tests. 2020-04-27 08:06:12 +02:00
François Freitag a8d175c297 Disabled management commands output with verbosity 0 in test_regression_22823_unmigrated_fk_to_migrated_model. 2020-04-27 07:43:09 +02:00
François Freitag da606513db
Removed unnecessary capturing of stdout in test_makemigrations_non_interactive_not_null_addition. 2020-04-25 20:53:53 +02:00
Tim Schilling a92cc84b4a Refs #31369 -- Deprecated models.NullBooleanField in favor of BooleanField(null=True). 2020-04-24 10:10:45 +02:00
David Wobrock 533b208775 Fixed #29224 -- Fixed removing index_together indexes if exists unique_together constraint on the same fields. 2020-04-23 12:28:51 +02:00
Hannes Ljungberg 447980e72a Fixed #31500 -- Fixed detecting of unique fields in QuerySet.in_bulk() when using Meta.constraints.
Detection of unique fields now takes into account non-partial unique
constraints.
2020-04-23 08:07:08 +02:00
Jon Dufresne d15d824deb
Refs #29892 -- Fixed selenium test test_inline_formset_error_input_border on Firefox.
Firefox does not include shorthand properties, such as "border", in the
computed CSS properties object. This is documented at MDN:

https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle

> The returned CSSStyleDeclaration object contains active values for CSS
> property longhand names. For example, border-bottom-width instead of
> the border-width and border shorthand property names. It is safest to
> query values with only longhand names like font-size. Shorthand names
> like font will not work with most browsers.

This difference between Firefox and Chrome is also discussed in the
stackoverflow thread at:

https://stackoverflow.com/a/32296604
2020-04-22 12:32:35 +02:00
David Smith 9a015f4e0d Completed test coverage for forms.RegexField. 2020-04-22 10:50:35 +02:00
Simon Charette 06889d6206 Fixed #31499 -- Stored ModelState.fields into a dict.
This allows the removal of its O(n) .get_field_by_name method and many
other awkward access patterns.

While fields were initially stored in a list to preserve the initial
model definiton field ordering the auto-detector doesn't take field
ordering into account and no operations exists to reorder fields of a
model.

This makes the preservation of the field ordering completely superflous
because field reorganization after the creation of the model state
wouldn't be taken into account.
2020-04-22 07:10:00 +02:00
Simon Charette 696024fb73 Refs #31499 -- Ignored field ordering to determine ModelState equality. 2020-04-22 06:20:54 +02:00
Mariusz Felisiak d5898db50e
Fixed backends.oracle.test_operations.
Using unittest.TestCase doesn't work properly when we perform db
queries. Moreover introspection is extremely slow on Oracle without
limiting models to a "backends" app.

Follow up to 8bcca47e83.
2020-04-21 15:46:18 +02:00
Jon Dufresne 75866b93cc Fixed #31479 -- Added support to reset sequences on SQLite. 2020-04-21 10:41:47 +02:00
Simon Charette 5220ca8d8a Refs #30591 -- Adjusted table rebuild for non-pk relationship on SQLite.
The existing code was only accounting for primary key changes and not
all unique key fields that can be referenced.
2020-04-21 08:37:47 +02:00
Simon Charette a548280857 Fixed #31064 -- Recreated auto-created many-to-many tables on primary key data type change on SQLite.
Both local and remote auto-created many-to-many relationships were
affected.
2020-04-21 08:37:40 +02:00
Simon Charette 2ba55b2905 Removed redundant import in tests/migrations/test_operations.py. 2020-04-21 08:37:37 +02:00
Jon Dufresne 505fec6bad Capitalized Unicode in docs, strings, and comments. 2020-04-20 12:10:33 +02:00
Jon Dufresne 3152146e3a
Added assertions for an empty stdout to CoreCommandsNoOutputTests. 2020-04-20 11:32:03 +02:00
Hasan Ramezani 35a67b3731 Fixed #31474 -- Made QuerySet.delete() not return the number of deleted objects if it's zero. 2020-04-20 09:51:54 +02:00
François Freitag c86201b6ed Disabled management commands output with verbosity 0 in various tests.
Instead of capturing the command output and discard it immediately,
tell the command not to log.
2020-04-20 09:09:26 +02:00
François Freitag 45e96b4d9d
Removed unnecessary capturing of stdout/stderr in auth_tests.test_management. 2020-04-20 09:08:43 +02:00
Jon Dufresne 5673d4b102
Fixed #31477 -- Removed "using" argument from DatabaseOperations.execute_sql_flush(). 2020-04-20 07:49:35 +02:00
Tom Forbes 141ab6bc6d Refs #29069 -- Added test for calling request_finished signal by static file responses.
Fixed in 41a3b3d186.
2020-04-20 06:17:57 +02:00
Jon Dufresne 537d422942
Simplified LongNameTest.test_sequence_name_length_limits_flush() with execute_sql_flush(). 2020-04-18 20:48:30 +02:00
hashlash dfbd9ca065 Fixed #30311 -- Restored ability to override global admin actions. 2020-04-17 20:23:00 +02:00
Jon Dufresne 75410228df Fixed #31473 -- Made sql_flush() use RESTART IDENTITY to reset sequences on PostgreSQL.
The sql_flush() positional argument sequences is replaced by the boolean
keyword-only argument reset_sequences. This ensures that the old
function signature can't be used by mistake when upgrading Django. When
the new argument is True, the sequences of the truncated tables will
reset. Using a single boolean value, rather than a list, allows making a
binary yes/no choice as to whether to reset all sequences rather than a
working on a completely different set.
2020-04-17 11:57:24 +02:00
Jon Dufresne 8bcca47e83 Added test coverage for DatabaseOperations.sql_flush(). 2020-04-17 09:52:43 +02:00
Mariusz Felisiak 4c9886085b
Refs #31351 -- Made partial constraints tests use required_db_features.
This will notably silence the warnings issued when running the test
suite on MySQL and MariaDB.
2020-04-17 07:45:52 +02:00
Hasan Ramezani 7b31ba541f Fixed #29329 -- Made datetime logging from runserver more consistent.
Setting default_msec_format=None will make it the same, unfortunately
it's not supported by Python, see https://bugs.python.org/issue40300.
2020-04-16 12:55:53 +02:00
Hasan Ramezani 96c6f9c61c Fixed #31441 -- Ensured TabluarInline expands when child inputs have errors. 2020-04-16 12:17:49 +02:00
Hasan Ramezani b4e7bf5284 Refs #31441 -- Added red border to inputs with errors for TabluarInline. 2020-04-16 12:17:49 +02:00
Author: Mads Jensen 6461583b6c Removed unused __str__() methods in tests models.
Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Co-Authored-By: Hasan Ramezani <hasan.r67@gmail.com>
2020-04-15 20:20:32 +02:00
Claude Paroz 71c4fb7beb Refs #27468 -- Changed default Signer algorithm to SHA-256. 2020-04-15 12:49:14 +02:00
Adam Johnson 4bb33bb074 Fixed #31459 -- Fixed handling invalid indentifiers in URL path conversion.
This patch adjusted existing tests that used invalid identifiers.
2020-04-15 11:29:35 +02:00
sobolevn 578c03b276 Fixed #31223 -- Added __class_getitem__() to Manager and QuerySet. 2020-04-15 11:26:11 +02:00
Ichlasul Affan 3e7c39f710 Fixed #31451 -- Made settings cleansing work with list and tuple settings. 2020-04-15 09:18:40 +02:00
007 d51c50d836 Fixed #31462 -- Allowed overriding autocomplete/raw_id_fields/filter widgets for ManyToManyFields with formfield_overrides. 2020-04-15 08:33:40 +02:00
Adam Johnson 5b884d45ac Fixed #29501 -- Allowed dbshell to pass options to underlying tool. 2020-04-14 14:02:51 +01:00
Adam Johnson 8e8c3f964e Refs #29501 -- Allowed customizing exit status for management commands. 2020-04-14 13:22:47 +02:00
Mariusz Felisiak 8189976663 Refs #29501 -- Added test for missing dbshell executable. 2020-04-14 13:22:46 +02:00
Claude Paroz a6b4c07b6e Refs #31196 -- Installed postgis_raster extension on PostGIS 3+. 2020-04-14 09:34:01 +02:00
Ichlasul Affan 53d229ff63 Fixed #31351 -- Added system checks for partial indexes and unique constraints support. 2020-04-10 12:00:27 +02:00
Mariusz Felisiak e8d3088925 Refs #31055 -- Allowed database queries in invalid_models_tests.test_models.FieldNamesTests. 2020-04-10 11:54:14 +02:00
David Smith c8c9dbfc63 Completed test coverage for BoundField.css_classes(). 2020-04-10 07:37:54 +02:00
David Smith a350bfa6f4 Fixed #13009 -- Added BoundField.widget_type property. 2020-04-10 07:11:14 +02:00
Carlton Gibson ed274a4ae4 Fixed #31407 -- Fixed unawaited coroutine warning for Python 3.8+.
Co-authored-by: Mark Korput <dr.theman@gmail.com>
2020-04-09 12:35:19 +02:00
Daniel Hahler 377018b6ff Fixed #30779 -- Improved selection of filenames in technical 500 debug page. 2020-04-09 11:28:26 +02:00
Simon Charette 8069526ce3 Made Operation.references_model/references_field require app_label.
This will allow them to drop a ton of logic to deal with null
app_label.
2020-04-09 10:08:06 +02:00
Simon Charette 25bf15c0da Refs #22608 -- Made app_label required when optimizing migrations.
This paved the way for the removal of lot of logic when app_label was
not specified.
2020-04-09 10:08:02 +02:00
David Smith 911545da1d Increased test coverage for forms.ImageField.to_python(). 2020-04-09 08:45:31 +02:00
Carlton Gibson 4bbe8261c4 Fixed #31437 -- Corrected tests to show abstract multiple inheritance system check error.
Added minimal multiple inheritance test case showing error.
Removed obsolete diamond-inheritance case, originally added in
85ef98dc6e.
2020-04-08 20:29:48 +02:00
Mariusz Felisiak 537b0c5edf
Fixed typo in tests/backends/base/test_operations.py. 2020-04-08 20:06:31 +02:00
Carlton Gibson 94b32a20ef Refs #28184 -- Added test for FileField storage default.
Co-authored-by: miigotu <miigotu@gmail.com>
2020-04-08 11:26:17 +02:00
miigotu 210657b791 Fixed #28184 -- Allowed using a callable for FileField and ImageField storage. 2020-04-08 11:26:17 +02:00
Mariusz Felisiak db6933a032
Refs #30966 -- Added test for reloading related model state on non-relational changes.
Thanks Markus Holtermann for initial test.

Fixed in 1d16c5d562.
2020-04-08 10:43:38 +02:00
Matthijs Kooijman 4f216e4f8e Fixed #31051 -- Allowed dumpdata to handle circular references in natural keys.
Since #26291 forward references in natural keys are properly handled by
loaddata, so sorting depenencies in dumpdata doesn't need to break on
cycles. This patch allows circular references in natural keys by
breaking sort_depenencies() on loops.
2020-04-07 20:41:59 +02:00
Mark 590957a0eb
Fixed #31407 -- Adjusted test to avoid coroutine never awaited warning. 2020-04-07 20:32:54 +02:00
Matthijs Kooijman 26799c6503 Refs #26291 -- Added tests for dumpdata/loaddata with forward references without natural keys. 2020-04-07 15:40:19 +02:00
Matthijs Kooijman fca36f3c98 Refs #26291 -- Added tests for dumpdata with forward references in natural keys. 2020-04-07 15:40:14 +02:00
Matthijs Kooijman 481d8fc324 Refs #31051 -- Added test for loaddata/dumpdata with circular references without natural keys. 2020-04-07 12:01:19 +02:00
Mariusz Felisiak cf21fc9bf0
Enforced uniqueness of natural keys used in tests. 2020-04-07 10:54:19 +02:00
Simon Charette 1d16c5d562 Refs #27666 -- Ensured relationship consistency on delayed reloads.
Delayed reloads of state models broke identity based relationships
between direct and non-direct ancestors.

Basing models.Options related objects map of model labels instead of
their identity ensured relationship consistency is maintained.

Refs #30966.

Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
2020-04-07 09:20:46 +02:00
François Freitag e03eb8db93 Fixed #31428 -- Allowed empty message in management command self.stdout/err proxies. 2020-04-07 08:45:11 +02:00
David Smith 5fbc0e07a9 Completed test coverage for forms.DurationField.to_python(). 2020-04-07 06:20:43 +02:00
David Smith be9dd70931
Fixed typo in tests/forms_tests/field_tests/test_imagefield.py test names. 2020-04-07 06:04:51 +02:00
Simon Charette 513948735b Fixed #31426 -- Added proper field validation to QuerySet.order_by().
Resolve the field reference instead of using fragile regex based string
reference validation.
2020-04-06 10:19:49 +02:00
Simon Charette 98ea4f0f46 Refs #7098 -- Deprecated passing raw column aliases to order_by().
Now that order_by() has expression support passing RawSQL() can achieve
the same result.

This was also already supported through QuerySet.extra(order_by) for
years but this API is more or less deprecated at this point.
2020-04-06 10:01:02 +02:00
Hasan Ramezani 4237050684 Fixed #31420 -- Fixed crash when filtering subquery annotation against a SimpleLazyObject.
Thanks Simon Charette for the solution and analysis.
2020-04-06 07:11:29 +02:00
Hasan Ramezani 6fbce45b03 Fixed #31415 -- Fixed crash when nested OuterRef is used with operators or in database functions. 2020-04-04 20:16:00 +02:00
Matthijs Kooijman 289d0ec6fd Refs #31051 -- Fixed reloading the database with circular related objects and natural keys for tests.
Made deserialize_db_from_string() do not sort dependencies.

deserialize_db_from_string() doesn't use natural keys, so there is no
need to sort dependencies in serialize_db_to_string(). Moreover,
sorting models cause issues for circular dependencies.
2020-04-02 11:35:33 +02:00
Matthijs Kooijman 12e6f573ad Refs #26552 -- Added test for reloading the database with self-referential objects. 2020-04-02 09:17:41 +02:00
hashlash 4a6f2b63d7 Fixed #31380 -- Added deployment system check for DJANGO_ALLOW_ASYNC_UNSAFE environment variable. 2020-04-01 12:51:11 +02:00
Mariusz Felisiak 195e0cb170
Refs #31040 -- Used 402 HTTP status in middleware_exceptions tests.
HTTP status code 418 - "I'm a Teaport" was added to http.HTTPStatus in
Python 3.9.0a5 [1] that caused failures in middleware_exceptions tests.

This changes HTTP status used in middleware_exceptions tests to 402,
which exists in all supported versions of Python.

[1] https://docs.python.org/3.9/whatsnew/3.9.html#http
2020-03-31 12:09:17 +02:00
Hasan Ramezani 8aa71f4e87 Fixed #31375 -- Made contrib.auth.hashers.make_password() accept only bytes or strings. 2020-03-31 10:52:56 +02:00
Hasan Ramezani b3ab92cc5a Refs #31375 -- Added test for contrib.auth.hashers.make_password() bytes support. 2020-03-31 10:49:39 +02:00
Gordon Pendleton d0da2820ca Fixed #31402 -- Added migrate --check option.
Command exits with non-zero status if unapplied migrations exist.
2020-03-26 20:12:39 +01:00
Hasan Ramezani 55cdf6c52d Fixed #29724 -- Fixed timezone handling in ModelAdmin.date_hierarchy queries.
Thanks Alexander Holmbäck for the initial patch.
2020-03-25 21:03:41 +01:00
Alexander Holmbäck e43c34d10d Added tests for date_hierarchy template tag with models.DateTimeField. 2020-03-25 21:03:23 +01:00
Mariusz Felisiak ab5720ad80
Removed unnecessary assertions in ExpressionOperatorTests.
These tests don't modify Number.float field.
2020-03-25 13:12:32 +01:00
Adam Johnson 9e1b6b8a66 Fixed #23916 -- Allowed makemigrations to handle related model name case changes.
Made autodetector ignore related model name case changes so unnecessary
migrations are not created.
2020-03-25 10:39:34 +01:00
Hannes Ljungberg f3da09df0f Fixed #31396 -- Added binary XOR operator to F expressions. 2020-03-25 10:16:30 +01:00
Carlton Gibson 39e1c88de6
Fixed intermittent SeleniumTests.test_prepopulated_fields failure.
Element would occasionally be outside of frame.
2020-03-25 09:58:57 +01:00
Hasan Ramezani 10866a10fe Fixed #31377 -- Disabled grouping by aliases on QuerySet.values()/values_list() when they collide with field names.
Regression in fb3f034f1c.

Thanks Holovashchenko Vadym for the report.
2020-03-25 09:13:46 +01:00
Mariusz Felisiak 895f28f9cb
Reverted "Pinned asgiref == 3.2.5 in test requirements."
This reverts commit aa21020218.

Regression was fixed by
e4367c571f.
2020-03-24 20:52:05 +01:00
David Smith 27746ab28a Fixed #7664 -- Allowed customizing suffixes of MultiWidget.widgets' names. 2020-03-24 20:05:18 +01:00
Mariusz Felisiak aa21020218
Pinned asgiref == 3.2.5 in test requirements. 2020-03-24 08:52:21 +01:00
Hannes Ljungberg 0b51a4f894 Fixed #28194 -- Added support for normalization and cover density to SearchRank. 2020-03-23 11:00:55 +01:00
Adam Johnson 4ed534758c Fixed #19878 -- Deprecated TemplateView passing URL kwargs into context. 2020-03-23 08:11:14 +01:00
Tim Graham e21788121b
Added missing Meta.apps to a schema model. 2020-03-23 06:09:10 +01:00
Adam Johnson ffde4d5da8
Normalized check framework test pattern. 2020-03-21 20:14:02 +01:00
Hasan Ramezani 53b6a466d8 Refs #29724 -- Added is_dst parameter to QuerySet.datetimes().
Thanks Simon Charette for the review and Mariusz Felisiak for tests.
2020-03-20 12:55:33 +01:00
Rohit 2695ac8e04 Fixed #31144 -- Relaxed system check for max_length of CharFields on MySQL/MariaDB by turning into a warning. 2020-03-20 12:28:10 +01:00
Jon Dufresne c1c361677d Made BaseCacheTests skip culling tests if culling is not supported. 2020-03-19 15:34:16 +01:00
Jon Dufresne 013147fae2 Fixed #31285 -- Fixed inherited Meta.ordering of "-pk". 2020-03-19 12:57:07 +01:00
gowthamk63 142ab6846a Fixed #31123 -- Added --include-stale-apps option to the remove_stale_contenttypes management command.
Co-Authored-By: Javier Buzzi <buzzi.javier@gmail.com>
2020-03-19 11:48:10 +01:00
Mariusz Felisiak 6e026aec5f
Refs #29548 -- Mentioned MariaDB in database system checks. 2020-03-19 09:42:04 +01:00
Andrew Godwin fc0fa72ff4 Fixed #31224 -- Added support for asynchronous views and middleware.
This implements support for asynchronous views, asynchronous tests,
asynchronous middleware, and an asynchronous test client.
2020-03-18 19:59:12 +01:00
Mariusz Felisiak 3f7e4b16bf Removed redundant get_max_column_name_length() calls in invalid_models_tests.test_models.FieldNamesTests. 2020-03-18 18:41:40 +01:00
Mariusz Felisiak 5c8441a0b8 Refs #31055 -- Made long column names checks support databases aware. 2020-03-18 18:41:40 +01:00
Baptiste Mispelon 3baf92cf82 Fixed #31340 -- Allowed query expressions in SearchQuery.value and __search lookup. 2020-03-16 10:27:23 +01:00
jay20162016 924c01ba09 Fixed #31363 -- Added support for negative integers to intword template filter. 2020-03-16 08:44:43 +01:00
Jon Dufresne 3857a08bdb Fixed #31361 -- Fixed invalid action="" in admin forms.
The attribute action="" (empty string) on the <form> element is invalid
HTML5. The spec (https://html.spec.whatwg.org/#attr-fs-action) says:

> The action and formaction content attributes, if specified, must have
> a value that is a valid non-empty URL potentially surrounded by
> spaces.

Emphasis on non-empty. The action attribute is allowed to be omitted, in
which case the current URL is used which is the same behavior as now.
2020-03-16 07:31:19 +01:00
Jon Dufresne b7093860df Added novalidate HTML attribute to ModelAdmin.add_view() and change_view() tests. 2020-03-16 06:36:45 +01:00
Mariusz Felisiak e2417010da Refs #31304 -- Added tests for using __search lookup with combined SearchQuerys with the same config. 2020-03-13 12:06:28 +01:00
Baptiste Mispelon dd704c6705 Refs #31340 -- Simplified SearchQuery by making it subclass Func. 2020-03-13 11:38:43 +01:00
Mariusz Felisiak 8725d04764
Fixed random auth_tests.test_tokens.TokenGeneratorTest.test_timeout failures.
Random failures depended on the current timestamp.

Thanks Matthijs Kooijman for the review.
2020-03-12 10:56:38 +01:00
David Smith ccf32aca44 Fixed #8760 -- Changed ModelMultipleChoiceField to use invalid_list as a error message key. 2020-03-12 09:36:01 +01:00
Mariusz Felisiak 7d8cdad6b7 Fixed MiddlewareNotUsedTests.test_do_not_log_when_debug_is_false().
This test didn't test anything without a middleware that raises an
exception.
2020-03-12 07:37:14 +01:00
Mariusz Felisiak 35c7fe8334 Completed test coverage for BaseHandler.process_exception_by_middleware(). 2020-03-12 07:37:14 +01:00
Claude Paroz e663f695fb Fixed #31359 -- Deprecated get_random_string() calls without an explicit length. 2020-03-11 13:16:44 +01:00
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