diff --git a/authentik/lib/widgets.py b/authentik/lib/widgets.py index f2104313b..2fb833941 100644 --- a/authentik/lib/widgets.py +++ b/authentik/lib/widgets.py @@ -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()