summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/db/models/base.py1
-rw-r--r--docs/releases/3.2.4.txt3
-rw-r--r--tests/check_framework/test_model_checks.py8
3 files changed, 12 insertions, 0 deletions
diff --git a/django/db/models/base.py b/django/db/models/base.py
index 5d10e7e06d..779d1fe0d5 100644
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -1298,6 +1298,7 @@ class Model(metaclass=ModelBase):
@classmethod
def _check_default_pk(cls):
if (
+ not cls._meta.abstract and
cls._meta.pk.auto_created and
# Inherited PKs are checked in parents models.
not (
diff --git a/docs/releases/3.2.4.txt b/docs/releases/3.2.4.txt
index 51a4898163..068798e6ed 100644
--- a/docs/releases/3.2.4.txt
+++ b/docs/releases/3.2.4.txt
@@ -12,3 +12,6 @@ Bugfixes
* 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
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`).
diff --git a/tests/check_framework/test_model_checks.py b/tests/check_framework/test_model_checks.py
index ad3bf1f8b1..c26cf53903 100644
--- a/tests/check_framework/test_model_checks.py
+++ b/tests/check_framework/test_model_checks.py
@@ -403,6 +403,14 @@ class ModelDefaultAutoFieldTests(SimpleTestCase):
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):
class Parent(models.Model):
id = models.AutoField(primary_key=True)