Kaydet (Commit) f5f556db authored tarafından Andrew Godwin's avatar Andrew Godwin

Unroll choices iterators in field deconstruction

üst 2a30b39f
...@@ -329,6 +329,10 @@ class Field(RegisterLookupMixin): ...@@ -329,6 +329,10 @@ class Field(RegisterLookupMixin):
equals_comparison = set(["choices", "validators", "db_tablespace"]) equals_comparison = set(["choices", "validators", "db_tablespace"])
for name, default in possibles.items(): for name, default in possibles.items():
value = getattr(self, attr_overrides.get(name, name)) 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 name in equals_comparison:
if value != default: if value != default:
keywords[name] = value keywords[name] = value
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment