mirror of
https://github.com/django/django.git
synced 2025-11-25 21:22:14 +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:
parent
b10d322c41
commit
21e559495b
8 changed files with 171 additions and 128 deletions
|
|
@ -125,7 +125,7 @@ class IntegerFieldTests(TestCase):
|
|||
ranged_value_field.run_validators(max_backend_value + 1)
|
||||
|
||||
def test_types(self):
|
||||
instance = self.model(value=0)
|
||||
instance = self.model(value=1)
|
||||
self.assertIsInstance(instance.value, int)
|
||||
instance.save()
|
||||
self.assertIsInstance(instance.value, int)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue