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?)
--
Ticket URL: <https://code.djangoproject.com/ticket/26609>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/26609#comment:1>
Comment (by hjwp):
ah, i think it's not just python 3: https://mail.python.org/pipermail
/python-announce-list/2012-March/009394.html
--
Ticket URL: <https://code.djangoproject.com/ticket/26609#comment:2>
* status: new => closed
* resolution: => wontfix
Comment:
I'm afraid there's not much we can do about it.
The `choices` option is meant to be ordered and the migration framework
correctly detects changes in ordering.
--
Ticket URL: <https://code.djangoproject.com/ticket/26609#comment:3>