summaryrefslogtreecommitdiff
path: root/django/newforms/fields.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/newforms/fields.py')
-rw-r--r--django/newforms/fields.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/django/newforms/fields.py b/django/newforms/fields.py
index 0f082b9ee3..8e3da03470 100644
--- a/django/newforms/fields.py
+++ b/django/newforms/fields.py
@@ -339,8 +339,9 @@ class ChoiceField(Field):
def _set_choices(self, value):
# Setting choices also sets the choices on the widget.
- self._choices = value
- self.widget.choices = value
+ # choices can be any iterable, but we call list() on it because
+ # it will be consumed more than once.
+ self._choices = self.widget.choices = list(value)
choices = property(_get_choices, _set_choices)