summaryrefslogtreecommitdiff
path: root/django/forms
diff options
context:
space:
mode:
authorDavid Sanders <dsanders11@ucsbalum.com>2016-05-08 09:58:34 +0000
committerTim Graham <timograham@gmail.com>2016-06-09 11:10:26 -0400
commit5ec64f96b2d83ec3c0ef574f52e4767a440017b8 (patch)
tree646d160ffb45d2414eb883b9d27b3878bce50523 /django/forms
parentae2a7da86bf841d42be86dea3effb0261187c950 (diff)
Fixed #26734 -- Made iterator class configurable on ModelChoiceField.
Diffstat (limited to 'django/forms')
-rw-r--r--django/forms/models.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/django/forms/models.py b/django/forms/models.py
index 0738421d9e..ff34ebfe78 100644
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -1128,6 +1128,7 @@ class ModelChoiceField(ChoiceField):
'invalid_choice': _('Select a valid choice. That choice is not one of'
' the available choices.'),
}
+ iterator = ModelChoiceIterator
def __init__(self, queryset, empty_label="---------",
required=True, widget=None, label=None, initial=None,
@@ -1195,7 +1196,7 @@ class ModelChoiceField(ChoiceField):
# accessed) so that we can ensure the QuerySet has not been consumed. This
# construct might look complicated but it allows for lazy evaluation of
# the queryset.
- return ModelChoiceIterator(self)
+ return self.iterator(self)
choices = property(_get_choices, ChoiceField._set_choices)