Merge pull request #2448 from alphagov/alphabetical-sort-letter-brandings

Make letter brandings easier to find with sorting and filtering
This commit is contained in:
Chris Hill-Scott
2018-11-07 13:50:05 +00:00
committed by GitHub
5 changed files with 51 additions and 19 deletions

View File

@@ -785,7 +785,14 @@ 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=lambda choice: (
choice[0] != kwargs.get('dvla_org_id'),
choice[0] != '001',
choice[1],
),
))
dvla_org_id = RadioField(
'Which logo should this services letter have?',