From b36afdc92407167cce82e33277083a4b2130bb21 Mon Sep 17 00:00:00 2001 From: Arthur Date: Tue, 29 Nov 2022 11:21:13 -0800 Subject: [PATCH] 11014 code review changes --- netbox/dcim/views.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index 199009286..7decb8b36 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -590,14 +590,16 @@ class RackElevationListView(generic.ObjectListView): total_count = racks.count() ORDERING_CHOICES = { - '_name': 'Name (A-Z)', - '-_name': 'Name (Z-A)', + 'name': 'Name (A-Z)', + '-name': 'Name (Z-A)', 'facility_id': 'Facility ID (A-Z)', '-facility_id': 'Facility ID (Z-A)', } - sort = request.GET.get('sort', "_name") + sort = request.GET.get('sort', "name") if sort not in ORDERING_CHOICES: - sort = '_name' + sort = 'name' + sort_choice = sort + sort = sort.replace("name", "_name") racks = racks.order_by(sort) @@ -622,7 +624,7 @@ class RackElevationListView(generic.ObjectListView): 'page': page, 'total_count': total_count, 'sort': sort, - 'sort_display_name': ORDERING_CHOICES[sort], + 'sort_display_name': ORDERING_CHOICES[sort_choice], 'sort_choices': ORDERING_CHOICES, 'rack_face': rack_face, 'filter_form': forms.RackElevationFilterForm(request.GET),