mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #32620 -- Allowed subclasses of Big/SmallAutoField for DEFAULT_AUTO_FIELD.
This commit is contained in:
committed by
Mariusz Felisiak
parent
30e123ed35
commit
45a58c31e6
@@ -4,6 +4,10 @@ from django.test import SimpleTestCase, override_settings
|
||||
from django.test.utils import isolate_apps
|
||||
|
||||
|
||||
class MyBigAutoField(models.BigAutoField):
|
||||
pass
|
||||
|
||||
|
||||
@isolate_apps('model_options')
|
||||
class TestDefaultPK(SimpleTestCase):
|
||||
@override_settings(DEFAULT_AUTO_FIELD='django.db.models.NonexistentAutoField')
|
||||
@@ -74,6 +78,15 @@ class TestDefaultPK(SimpleTestCase):
|
||||
|
||||
self.assertIsInstance(Model._meta.pk, models.SmallAutoField)
|
||||
|
||||
@override_settings(
|
||||
DEFAULT_AUTO_FIELD='model_options.test_default_pk.MyBigAutoField'
|
||||
)
|
||||
def test_default_auto_field_setting_bigautofield_subclass(self):
|
||||
class Model(models.Model):
|
||||
pass
|
||||
|
||||
self.assertIsInstance(Model._meta.pk, MyBigAutoField)
|
||||
|
||||
@isolate_apps('model_options.apps.ModelPKConfig')
|
||||
@override_settings(DEFAULT_AUTO_FIELD='django.db.models.AutoField')
|
||||
def test_app_default_auto_field(self):
|
||||
|
||||
Reference in New Issue
Block a user