parent
19eea68e0f
commit
37b59bb5b9
|
@ -10,7 +10,7 @@ class GroupedModelChoiceIterator(ModelChoiceIterator):
|
|||
def __iter__(self):
|
||||
if self.field.empty_label is not None:
|
||||
yield ("", self.field.empty_label)
|
||||
queryset = self.queryset
|
||||
queryset = self.queryset.order_by("name")
|
||||
# Can't use iterator() when queryset uses prefetch_related()
|
||||
if not queryset._prefetch_related_lookups:
|
||||
queryset = queryset.iterator()
|
||||
|
|
Reference in New Issue