Opened 5 years ago

Closed 5 years ago

#21469 closed Bug (fixed)

makemigrations and normalize_unique_together

Reported by: django@… Owned by: Baptiste Mispelon <bmispelon@…>
Component: Migrations Version: master
Severity: Normal Keywords:
Cc: Baptiste Mispelon Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


normalize_unique_together breaks when it is given a set(), but that's what Django migration's autodetector provides when running makemigrations.

To reproduce:

  • Create a model with unique_together
  • Run makemigrations

Seems to have been introduced on Oct 7 in the fix for #21236 (4dbd95a)

Change History (4)

comment:1 Changed 5 years ago by Tim Graham

Triage Stage: UnreviewedAccepted

comment:2 Changed 5 years ago by Baptiste Mispelon

Cc: Baptiste Mispelon added
Has patch: set

What about simply forcing unique_together to be a tuple at the beginning of normalize_unique_together()?

PR (with tests) here:

comment:3 Changed 5 years ago by Tim Graham

Triage Stage: AcceptedReady for checkin

comment:4 Changed 5 years ago by Baptiste Mispelon <bmispelon@…>

Owner: set to Baptiste Mispelon <bmispelon@…>
Resolution: fixed
Status: newclosed

In 331d79a77d48e1a46df0290689d4d865e67221c4:

Fixed #21469 -- Allow set objects in Meta.unique_together.

Thanks to Tim for the review.

Note: See TracTickets for help on using tickets.
Back to Top