mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #26734 -- Made iterator class configurable on ModelChoiceField.
This commit is contained in:
committed by
Tim Graham
parent
ae2a7da86b
commit
5ec64f96b2
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user