Skip to content

Commit

Permalink
Sort charfield choices openlibhums/consortial_billing#82
Browse files Browse the repository at this point in the history
  • Loading branch information
joemull committed Nov 15, 2024
1 parent 396e2f6 commit 317b236
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/core/forms/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,8 @@ def __init__(self, *args, **kwargs):
count = values_list.count(value)
label_with_count = f'{label} ({count})'
choices.append((value, label_with_count))

choices = sorted(choices, key=lambda x: x[1])
self.fields[facet_key] = forms.ChoiceField(
widget=forms.widgets.CheckboxSelectMultiple,
choices=choices,
Expand Down

0 comments on commit 317b236

Please sign in to comment.