1
0
mirror of https://github.com/django/django.git synced 2025-10-27 15:46:10 +00:00

Fixed #36357 -- Skipped unique_together in inspectdb output for composite primary keys.

Thanks to Baptiste Mispelon for the report and quick fix, and to Simon
Charette and Jacob Walls for the reviews.

Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
This commit is contained in:
Baptiste Mispelon
2025-04-28 09:48:12 +02:00
committed by nessita
parent 07100db6f4
commit 66f9eb0ff1
3 changed files with 10 additions and 1 deletions

View File

@@ -391,7 +391,7 @@ class Command(BaseCommand):
columns = [
x for x in columns if x is not None and x in column_to_field_name
]
if len(columns) > 1:
if len(columns) > 1 and not params["primary_key"]:
unique_together.append(
str(tuple(column_to_field_name[c] for c in columns))
)