diff options
| author | Baptiste Mispelon <baptiste.mispelon@torchbox.com> | 2025-04-28 09:48:12 +0200 |
|---|---|---|
| committer | Natalia <124304+nessita@users.noreply.github.com> | 2025-04-30 11:55:56 -0300 |
| commit | 1367a197dda2027e4fcf33e3053244fdcbda9d8c (patch) | |
| tree | 56b62850c96b51fe07f385be055bb2fce892ab66 /django/core | |
| parent | ec73fd67466e0e4841d9ecd0f217c02ce842d860 (diff) | |
[5.2.x] 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>
Backport of 66f9eb0ff1e7147406318c5ba609729678e4e6f6 from main.
Diffstat (limited to 'django/core')
| -rw-r--r-- | django/core/management/commands/inspectdb.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/django/core/management/commands/inspectdb.py b/django/core/management/commands/inspectdb.py index 58594fb66f..81f0cbefea 100644 --- a/django/core/management/commands/inspectdb.py +++ b/django/core/management/commands/inspectdb.py @@ -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)) ) |
