diff options
| author | Patryk Zawadzki <patrys@room-303.com> | 2012-12-19 19:12:08 +0100 |
|---|---|---|
| committer | Anssi Kääriäinen <akaariai@gmail.com> | 2012-12-19 22:51:12 +0200 |
| commit | 3989ce52ef78840eefe01541628daa220191c0ad (patch) | |
| tree | c9852252bf001eb4c555e7db8426f8050056199d /django/forms | |
| parent | abd0f304b162b3120b1c7321fbfc3090e5f3c92c (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.py | 4 |
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) |
