Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Unroll choices iterators in field deconstruction

  • Loading branch information...
commit f5f556dba3c89333d4533e0603de79b62083d807 1 parent 2a30b39
Andrew Godwin andrewgodwin authored
Showing with 4 additions and 0 deletions.
  1. +4 −0 django/db/models/fields/__init__.py
4 django/db/models/fields/__init__.py
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.