summaryrefslogtreecommitdiff
path: root/django/newforms/fields.py
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-02-20 03:05:09 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-02-20 03:05:09 +0000
commita52cc033749d288aa117f480959e43e7c8b8f031 (patch)
treeb5576343e7770e039c292bbf11ac05eabf08fd57 /django/newforms/fields.py
parentbdfbcb2cd51643d2d866eda8820b62521901a007 (diff)
Fixed #3490 -- Fixed issue with newforms ChoiceField and generators as choices. Thanksfor the patch, Chris.Wesseling@cwi.nl
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4549 bcc190cf-cafb-0310-a4f2-bffc1f526a37
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)