Commit Graph

139 Commits

Author SHA1 Message Date
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
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
Taoup 271fdab8b7 Fixed #31286 -- Made database specific fields checks databases aware.
Follow up to 0b83c8cc4d.
2020-02-24 14:23:46 +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
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
Simon Charette 71756bdfed Fixed #31055 -- Made constraint checks support databases aware. 2020-02-07 11:03:53 +01:00
Nick Pope 335c9c94ac Simplified imports from django.db and django.contrib.gis.db. 2020-02-04 13:20:06 +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
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
Caio Ariede 555bebe774 Fixed #30987 -- Added models.PositiveBigIntegerField. 2019-11-19 09:34:11 +01: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
Nick Pope b6251956b6 Fixed #30757 -- Added a system check to ensure max_length fits the longest choice. 2019-09-09 10:28:18 +02:00
Nick Pope 21e559495b Fixed #29979, Refs #17337 -- Extracted AutoField field logic into a mixin and refactored AutoFields.
This reduces duplication by allowing AutoField, BigAutoField and
SmallAutoField to inherit from IntegerField, BigIntegerField and
SmallIntegerField respectively. Doing so also allows for enabling the
max_length warning check and minimum/maximum value validation for auto
fields, as well as providing a mixin that can be used for other possible
future auto field types such as a theoretical UUIDAutoField.
2019-08-20 09:22:25 +02:00
Simon Charette 8b3e1b6e9e Refs #11964 -- Made constraint support check respect required_db_features.
This will notably silence the warnings issued when running the test
suite on MySQL.
2019-08-12 06:44:37 +02:00
can 53209f7830 Fixed #30613 -- Moved index name validation to system checks. 2019-07-05 09:30:21 +02:00
Nadège Michel 87b1ad6e73 Fixed #30421 -- Allowed symmetrical intermediate table for self-referential ManyToManyField. 2019-06-21 15:03:17 +02:00
zeyneloz 6485a5f450 Fixed #30409 -- Allowed using foreign key's attnames in unique/index_together and Index's fields. 2019-05-01 11:51:27 +02:00
Ramiro Morales aed89adad5 Fixed #30367 -- Changed "pip install" to "python -m pip install" in docs, comments and hints. 2019-04-18 14:41:15 +02:00
Hasan Ramezani 981dd6dd71
Fixed #28431 -- Added a system check for BinaryField to prevent strings defaults.
Thanks Claude Paroz for the initial patch.
2019-03-25 20:04:35 +01:00
Mariusz Felisiak f69c7bbdce
Refs #29408 -- Cosmetic edits for validation of related fields and lookups in model Meta.ordering.
Follow up to 440505cb2c.
2019-03-01 19:38:21 +01:00
Hasan Ramezani 440505cb2c Fixed #29408 -- Added validation of related fields and lookups in model Meta.ordering. 2019-03-01 17:09:33 +01:00
Sergey Fedoseev 1933e56eca Removed uneeded generator expressions and list comprehensions. 2019-02-09 09:18:48 -05:00
Simon Charette b181aba7dd Refs #28478 -- Prevented database feature based skipping on tests disallowing queries.
Database features may require a connection to be established to determine
whether or not they are enabled.
2019-01-14 16:16:30 -05:00
Tim Graham 193c109327 Switched TestCase to SimpleTestCase where possible in Django's tests. 2018-11-27 08:58:44 -05:00
Nick Pope c512912463 Refs #23801 -- Made integer field max_length warning show correct field type. 2018-11-23 14:40:46 -05:00
Hasan Ramezani ec16588c27 Added test for Model._check_column_name_clashes(). 2018-11-17 15:24:48 -05:00
Simon Charette 9142bebff2 Refs #11964 -- Changed CheckConstraint() signature to use keyword-only arguments.
Also renamed the `constraint` argument to `check` to better represent which
part of the constraint the provided `Q` object represents.
2018-10-02 10:53:04 -04:00
Simon Willison 586a9dc429 Fixed #26352 -- Made system check allow ManyToManyField to target the same model if through_fields differs. 2018-08-22 12:07:29 -04:00
Franck Michea 7def8bed58 Fixed #29698 -- Fixed Field._check_choices() crash on invalid choices. 2018-08-22 09:15:19 -04:00
Ian Foote 952f05a6db Fixed #11964 -- Added support for database check constraints. 2018-07-10 15:32:33 -04:00
Tim Graham c03e41712b
Refs #28748 -- Reallowed lazy model field choices.
Regression in 3aa9ab39cc.
2018-05-29 21:43:38 -04:00
Carlton Gibson 21fd8041c1
Refs #29358 -- Corrected wording in primary key check message. 2018-05-03 15:28:37 +02:00
Hasan Ramezani 816b8d9518 Fixed #29358 -- Added a system check to prohibit models with more than one primary_key field. 2018-05-03 09:08:29 +02:00
Brett Cannon 64b74804c5 Fixed #29334 -- Updated pypi.python.org URLs to pypi.org. 2018-04-17 20:24:27 -04:00
Tim Graham 5fa4f40f45 Fixed #29227 -- Allowed BooleanField to be null=True.
Thanks Lynn Cyrin for contributing to the patch, and Nick Pope for review.
2018-03-20 12:10:10 -04:00
Mariusz Felisiak 362813d628
Fixed hanging indentation in various code. 2018-03-16 10:54:34 +01:00
François Freitag 3aa9ab39cc Refs #28748 -- Reallowed lazy values in model field choices.
Regression in f9844f4841.

Thanks Matthias Kestenholz for the report and suggestions.
2018-01-27 09:19:56 -05:00
François Freitag f9844f4841 Fixed #28748 -- Made model field choices check more strict for named groups. 2018-01-24 10:34:24 -05:00
François Freitag 8cdeb8acfc Added more tests for model field choices validation. 2018-01-24 10:27:27 -05:00
Дилян Палаузов a38ae914d8 Fixed #28996 -- Simplified some boolean constructs and removed trivial continue statements. 2018-01-12 12:44:50 -05:00
shanghui cc6bcc6ff5 Fixed #28867 -- Added system check for a model property that clashes with a related field accessor. 2018-01-03 10:34:31 -05:00
shanghui b0a2a2b07e Made a few cleanups to invalid_models_tests.test_models. 2017-12-29 10:32:01 -05:00
hui shang f1aa58479c Fixed #28714 -- Added system checks for invalid model field names in Meta.indexes.
Thanks Gabriel for the report and Adam Johnson for the review.
2017-12-27 18:56:24 -05:00
Adam Johnson f816ceedf1 Made assertions in invalid_models_tests consistent. 2017-07-11 13:12:17 -04:00
Jon Dufresne 21046e7773 Fixed #28249 -- Removed unnecessary dict.keys() calls.
iter(dict) is equivalent to iter(dict.keys()).
2017-05-27 19:08:46 -04:00
Mariusz Felisiak 538bf43458 Fixed #27859 -- Ignored db_index for TextField/BinaryField on Oracle and MySQL.
Thanks Zubair Alam for the initial patch and Tim Graham for the review.
2017-05-23 17:02:40 +02:00
Carles Pina Estany 9f2e8b5bb7 Fixed #28120 -- Checked that CharField.max_length is not a boolean. 2017-04-24 18:49:31 -04:00
Adam Chainz a452dddb25 Fixed #27904 -- Added a system check that Field.validators are callable. 2017-03-11 12:27:29 -05:00