Browse files

Unroll choices iterators in field deconstruction

  • Loading branch information...
1 parent 2a30b39 commit f5f556dba3c89333d4533e0603de79b62083d807 @andrewgodwin andrewgodwin committed Jan 25, 2014
Showing with 4 additions and 0 deletions.
  1. +4 −0 django/db/models/fields/__init__.py
View
4 django/db/models/fields/__init__.py
@@ -329,6 +329,10 @@ def deconstruct(self):
equals_comparison = set(["choices", "validators", "db_tablespace"])
for name, default in possibles.items():
value = getattr(self, attr_overrides.get(name, name))
+ # Unroll anything iterable for choices into a concrete list
+ if name == "choices" and isinstance(value, collections.Iterable):
+ value = list(value)
+ # Do correct kind of comparison
if name in equals_comparison:
if value != default:
keywords[name] = value

0 comments on commit f5f556d

Please sign in to comment.