diff options
| author | Hal Blackburn <hwtb2@cam.ac.uk> | 2025-11-04 05:58:46 +0000 |
|---|---|---|
| committer | Jacob Walls <jacobtylerwalls@gmail.com> | 2025-11-04 12:00:58 -0500 |
| commit | cbdf128cb316bccf9ca3b3b4966e57bd050bfc8a (patch) | |
| tree | e4c173ab14835ad00637a4a31f90f79f8e40c6d7 /django | |
| parent | 6775888470317a6d69121779b489bb2dc7350318 (diff) | |
[5.2.x] Fixed #36704 -- Fixed system check error for proxy model with a composite pk.
Proxy models subclassing a model with a CompositePrimaryKey were
incorrectly reporting check errors because the check that requires only
local fields to be used in a composite pk was evaluated against the proxy
subclass, which has no fields.
To fix this, composite pk field checks are not evaluated against
proxy subclasses, as none of the checks are applicable to proxy
subclasses. This also has the benefit of not double-reporting real check
errors from an invalid superclass pk.
Thanks Clifford Gama for the review.
Backport of 74564946c3b42a2ef7d087047e49873847a7e1d9 from main.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/base.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/models/base.py b/django/db/models/base.py index d7d207901b..77353121f5 100644 --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -1782,7 +1782,7 @@ class Model(AltersData, metaclass=ModelBase): meta = cls._meta pk = meta.pk - if not isinstance(pk, CompositePrimaryKey): + if meta.proxy or not isinstance(pk, CompositePrimaryKey): return errors seen_columns = defaultdict(list) |
