mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Fixed #32733 -- Skipped system check for specifying type of auto-created primary keys on abstract models.
Regression in b5e12d490a
.
This commit is contained in:
parent
f07723aa0a
commit
a24fed399c
@ -1302,6 +1302,7 @@ class Model(metaclass=ModelBase):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def _check_default_pk(cls):
|
def _check_default_pk(cls):
|
||||||
if (
|
if (
|
||||||
|
not cls._meta.abstract and
|
||||||
cls._meta.pk.auto_created and
|
cls._meta.pk.auto_created and
|
||||||
# Inherited PKs are checked in parents models.
|
# Inherited PKs are checked in parents models.
|
||||||
not (
|
not (
|
||||||
|
@ -12,3 +12,6 @@ Bugfixes
|
|||||||
* Fixed a bug in Django 3.2 where a final catch-all view in the admin didn't
|
* Fixed a bug in Django 3.2 where a final catch-all view in the admin didn't
|
||||||
respect the server-provided value of ``SCRIPT_NAME`` when redirecting
|
respect the server-provided value of ``SCRIPT_NAME`` when redirecting
|
||||||
unauthenticated users to the login page (:ticket:`32754`).
|
unauthenticated users to the login page (:ticket:`32754`).
|
||||||
|
|
||||||
|
* Fixed a bug in Django 3.2 where a system check would crash on an abstract
|
||||||
|
model (:ticket:`32733`).
|
||||||
|
@ -403,6 +403,14 @@ class ModelDefaultAutoFieldTests(SimpleTestCase):
|
|||||||
|
|
||||||
self.assertEqual(checks.run_checks(app_configs=self.apps.get_app_configs()), [])
|
self.assertEqual(checks.run_checks(app_configs=self.apps.get_app_configs()), [])
|
||||||
|
|
||||||
|
def test_skipped_on_abstract_model(self):
|
||||||
|
class Abstract(models.Model):
|
||||||
|
class Meta:
|
||||||
|
abstract = True
|
||||||
|
|
||||||
|
# Call .check() because abstract models are not registered.
|
||||||
|
self.assertEqual(Abstract.check(), [])
|
||||||
|
|
||||||
def test_explicit_inherited_parent_link(self):
|
def test_explicit_inherited_parent_link(self):
|
||||||
class Parent(models.Model):
|
class Parent(models.Model):
|
||||||
id = models.AutoField(primary_key=True)
|
id = models.AutoField(primary_key=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user