summaryrefslogtreecommitdiff
path: root/django/forms
diff options
context:
space:
mode:
authorPatryk Zawadzki <patrys@room-303.com>2012-12-19 19:12:08 +0100
committerAnssi Kääriäinen <akaariai@gmail.com>2012-12-19 22:51:12 +0200
commit3989ce52ef78840eefe01541628daa220191c0ad (patch)
treec9852252bf001eb4c555e7db8426f8050056199d /django/forms
parentabd0f304b162b3120b1c7321fbfc3090e5f3c92c (diff)
Fixed #18172 -- Made models with __iter__ usable in ModelMultipleChoiceField
Thanks to Patryk Zawadzki for the patch.
Diffstat (limited to 'django/forms')
-rw-r--r--django/forms/models.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/django/forms/models.py b/django/forms/models.py
index e9b71ccf26..0913a4e8b8 100644
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -1033,6 +1033,8 @@ class ModelMultipleChoiceField(ModelChoiceField):
return qs
def prepare_value(self, value):
- if hasattr(value, '__iter__') and not isinstance(value, six.text_type):
+ if (hasattr(value, '__iter__') and
+ not isinstance(value, six.text_type) and
+ not hasattr(value, '_meta')):
return [super(ModelMultipleChoiceField, self).prepare_value(v) for v in value]
return super(ModelMultipleChoiceField, self).prepare_value(value)