mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-15 07:18:58 -04:00
Sort letter brandings alphabetically
Currently the brandings have non-deterministic sorting, which means the order changes from page load to page load. This makes it hard to find the item you’re looking for. This commit sorts them by the name of the branding, same as for email brandings.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import weakref
|
||||
from datetime import datetime, timedelta
|
||||
from itertools import chain
|
||||
from operator import itemgetter
|
||||
|
||||
import pytz
|
||||
from flask_wtf import FlaskForm as Form
|
||||
@@ -785,7 +786,10 @@ class LetterBranding(StripWhitespaceForm):
|
||||
|
||||
def __init__(self, choices=[], *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.dvla_org_id.choices = choices
|
||||
self.dvla_org_id.choices = list(sorted(
|
||||
choices,
|
||||
key=itemgetter(1),
|
||||
))
|
||||
|
||||
dvla_org_id = RadioField(
|
||||
'Which logo should this service’s letter have?',
|
||||
|
||||
Reference in New Issue
Block a user