From 21e559495b8255bba1e8a4429cd083246ab90457 Mon Sep 17 00:00:00 2001 From: Nick Pope Date: Mon, 11 Dec 2017 15:36:33 +0000 Subject: 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. --- tests/validation/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tests/validation') diff --git a/tests/validation/models.py b/tests/validation/models.py index 953370bc37..e8e18cfbce 100644 --- a/tests/validation/models.py +++ b/tests/validation/models.py @@ -130,4 +130,7 @@ try: auto2 = models.AutoField(primary_key=True) except AssertionError as exc: assertion_error = exc -assert str(assertion_error) == "Model validation.MultipleAutoFields can't have more than one AutoField." +assert str(assertion_error) == ( + "Model validation.MultipleAutoFields can't have more than one " + "auto-generated field." +) -- cgit v1.3