1
0
mirror of https://github.com/django/django.git synced 2024-12-24 18:16:19 +00:00

Unroll choices iterators in field deconstruction

This commit is contained in:
Andrew Godwin 2014-01-25 00:23:28 +00:00
parent 2a30b39f40
commit f5f556dba3

View File

@ -329,6 +329,10 @@ class Field(RegisterLookupMixin):
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