Make region list case-insensitive sorted
Function sorted() output the result as ASCII sequence in default. sorted(['Region1', 'myregion']) will not change sequence. Fix it for tenant list too. Change-Id: I2e4e546ac70af1f758b618cf253f518a475b8392 Closes-Bug: #1439791
This commit is contained in:
parent
80a0361a17
commit
d9ebebb736
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user