summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorBendeguz Csirmaz <csirmazbendeguz@gmail.com>2025-01-13 19:33:47 +0800
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-01-13 14:21:41 +0100
commitd83fb782d33aa7aaa1b2c995c648a59eddb46047 (patch)
treea825df76c6c0a0e405c019719b4f53ea58ae1f24 /django
parentbf7b17d16d3978b2e1cee4a0f7ce8840bd1a8dc4 (diff)
Fixed #36092 -- Disallowed non-local fields in composite primary keys.
Diffstat (limited to 'django')
-rw-r--r--django/db/models/base.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/django/db/models/base.py b/django/db/models/base.py
index ae2a494747..a4d5a0d553 100644
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -1803,6 +1803,8 @@ class Model(AltersData, metaclass=ModelBase):
hint = f"{field_name!r} field may not set 'null=True'."
elif field.generated:
hint = f"{field_name!r} field is a generated field."
+ elif field not in meta.local_fields:
+ hint = f"{field_name!r} field is not a local field."
else:
seen_columns[field.column].append(field_name)