Merge "Make region list case-insensitive sorted"

This commit is contained in:
Jenkins 2016-03-17 03:41:30 +00:00 committed by Gerrit Code Review
commit f071f9e3e7

View File

@ -77,14 +77,13 @@ def show_domain_list(context):
@register.inclusion_tag('context_selection/_project_list.html',
takes_context=True)
def show_project_list(context):
max_proj = getattr(settings,
'DROPDOWN_MAX_ITEMS',
30)
max_proj = getattr(settings, 'DROPDOWN_MAX_ITEMS', 30)
if 'request' not in context:
return {}
request = context['request']
context = {'projects': sorted(context['authorized_tenants'],
key=lambda project: project.name)[:max_proj],
projects = sorted(context['authorized_tenants'],
key=lambda project: project.name.lower())
context = {'projects': projects[:max_proj],
'project_id': request.user.project_id,
'request': request}
return context
@ -97,7 +96,8 @@ def show_region_list(context):
return {}
request = context['request']
context = {'region_name': request.user.services_region,
'regions': sorted(request.user.available_services_regions),
'regions': sorted(request.user.available_services_regions,
key=lambda x: x.lower()),
'request': request}
return context