summaryrefslogtreecommitdiff
path: root/django/db
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2021-01-20 12:07:14 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-01-21 09:03:07 +0100
commita03a36121d22c8784985c7e45727eddef6a3ea7f (patch)
treef0b8ab25117d004ef6856545cffc5a4dd7fc1d63 /django/db
parent0c42cdf0d2422f4c080e93594d5d15381d6e955e (diff)
Fixed #32367 -- Fixed system check for specifying type of auto-created primary keys for inherited PKs.
Regression in b5e12d490af3debca8c55ab3c1698189fdedbbdb. Thanks אורי for the report.
Diffstat (limited to 'django/db')
-rw-r--r--django/db/models/base.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/django/db/models/base.py b/django/db/models/base.py
index 4038859cfa..2428218696 100644
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -1299,6 +1299,11 @@ class Model(metaclass=ModelBase):
def _check_default_pk(cls):
if (
cls._meta.pk.auto_created and
+ # Inherited PKs are checked in parents models.
+ not (
+ isinstance(cls._meta.pk, OneToOneField) and
+ cls._meta.pk.remote_field.parent_link
+ ) and
not settings.is_overridden('DEFAULT_AUTO_FIELD') and
not cls._meta.app_config._is_default_auto_field_overridden
):