Merge pull request #154 from hongwei1/master

feature/added sort Banks
This commit is contained in:
Simon Redfern 2021-12-15 03:03:30 -06:00 committed by GitHub
commit 36386568cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -179,7 +179,7 @@ class IndexBranchesView(LoginRequiredMixin, FormView):
urlpath = '/banks'
result = api.get(urlpath)
if 'banks' in result:
return [bank['id'] for bank in result['banks']]
return [bank['id'] for bank in sorted(result['banks'], key=lambda d: d['id'])]
else:
return []
except APIError as err:

View File

@ -169,7 +169,7 @@ class API(object):
"""Gets a list of bank ids and bank ids as used by form choices"""
choices = [('', 'Choose ...')]
result = self.get('/banks')
for bank in result['banks']:
for bank in sorted(result['banks'], key=lambda d: d['id']) :
choices.append((bank['id'], bank['id']))
return choices