Sort networks and projects by name instead of UUID

Change-Id: I73b9f05303917300121ed99042cdd5004184261b
Closes-Bug: 1375206
This commit is contained in:
Sam Betts 2014-10-01 12:09:27 +01:00
parent 35487bf8a0
commit 302cfccb99
2 changed files with 3 additions and 1 deletions

View File

@ -677,6 +677,7 @@ class SetNetworkAction(workflows.Action):
for n in networks:
n.set_id_as_name_if_empty()
network_list.append((n.id, n.name))
sorted(network_list, key=lambda obj: obj[1])
except Exception:
exceptions.handle(request,
_('Unable to retrieve networks.'))

View File

@ -66,7 +66,8 @@ def show_project_list(context):
if 'request' not in context:
return {}
request = context['request']
context = {'projects': sorted(context['authorized_tenants']),
context = {'projects': sorted(context['authorized_tenants'],
key=lambda project: project.name),
'project_id': request.user.project_id,
'request': request}
return context