id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 26609 Spurious migrations caused by non-deteministic field choices order Harry Percival nobody "Not sure if this is *quite* a bug, but thought I'd mention it since it was a puzzler. I had an app that seemed to be generatic infinite migrations, ie ""makemigrations"" would always create new migrations even if I didn't do anything about it. Eventually I figured out it was (I think) due to Python's non-deterministic dict ordering behaviour (this may be Python 3 only, IIRC said nondetermininstic ordering is to avoid some sort of security thing). code, eg: {{{ THINGS = { 'key1': 'val1', 'key2': 'val2', #etc } # ... myfield = models.CharField(choices=[(k,v) for k,v in THINGS], max_length=255) }}} I fixed it by using ""sorted"" on my list comprehension, but I imagine other people might be v confused, and it feels like something ppl are quite likely to do (use a dict for the basis of choices in a field?)" Bug closed Database layer (models, ORM) 1.9 Normal wontfix migrations Unreviewed 0 0 0 0 0 0