mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
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.
This commit is contained in:
committed by
Mariusz Felisiak
parent
b10d322c41
commit
21e559495b
@@ -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."
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user