1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Refs #31007 -- Added test for check for specifying type of auto-created primary keys from abstract models.

This commit is contained in:
Rust Saiargaliev 2021-05-18 12:53:02 +02:00 committed by Mariusz Felisiak
parent 27d4573d35
commit f07723aa0a

View File

@ -434,6 +434,18 @@ class ModelDefaultAutoFieldTests(SimpleTestCase):
Warning(self.msg, hint=self.hint, obj=Parent, id='models.W042'), Warning(self.msg, hint=self.hint, obj=Parent, id='models.W042'),
]) ])
def test_auto_created_pk_inherited_abstract_parent(self):
class Parent(models.Model):
class Meta:
abstract = True
class Child(Parent):
pass
self.assertEqual(checks.run_checks(app_configs=self.apps.get_app_configs()), [
Warning(self.msg, hint=self.hint, obj=Child, id='models.W042'),
])
@override_settings(DEFAULT_AUTO_FIELD='django.db.models.BigAutoField') @override_settings(DEFAULT_AUTO_FIELD='django.db.models.BigAutoField')
def test_default_auto_field_setting(self): def test_default_auto_field_setting(self):
class Model(models.Model): class Model(models.Model):