#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: bmispelon 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 23 months ago by timo

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 23 months ago by bmispelon

  • Cc bmispelon 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: https://github.com/django/django/pull/1946

comment:3 Changed 23 months ago by timo

  • Triage Stage changed from Accepted to Ready for checkin

comment:4 Changed 23 months ago by Baptiste Mispelon <bmispelon@…>

  • Owner set to Baptiste Mispelon <bmispelon@…>
  • Resolution set to fixed
  • Status changed from new to closed

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