reverse sorting in location list and when determining point location

This commit is contained in:
Laura Klünder 2016-12-19 18:13:14 +01:00
parent 5facc7827d
commit 1c70dbefc2
2 changed files with 2 additions and 2 deletions

View file

@ -169,7 +169,7 @@ class LocationViewSet(CachedReadOnlyViewSetMixin, ViewSet):
def list(self, request, **kwargs): def list(self, request, **kwargs):
locations = [] locations = []
locations += sorted(filter_queryset_by_package_access(request, AreaLocation.objects.filter(can_search=True)), locations += sorted(filter_queryset_by_package_access(request, AreaLocation.objects.filter(can_search=True)),
key=AreaLocation.get_sort_key) key=AreaLocation.get_sort_key, reverse=True)
locations += list(filter_queryset_by_package_access(request, LocationGroup.objects.filter(can_search=True))) locations += list(filter_queryset_by_package_access(request, LocationGroup.objects.filter(can_search=True)))
return Response([location.to_location_json() for location in locations]) return Response([location.to_location_json() for location in locations])

View file

@ -56,7 +56,7 @@ class Route:
print(point.arealocations) print(point.arealocations)
locations = sorted(AreaLocation.objects.filter(location_type__in=('room', 'level', 'area'), locations = sorted(AreaLocation.objects.filter(location_type__in=('room', 'level', 'area'),
name__in=point.arealocations), name__in=point.arealocations),
key=AreaLocation.get_sort_key) key=AreaLocation.get_sort_key, reverse=True)
if not locations: if not locations:
return _('Unknown Location'), _('Unknown Location') return _('Unknown Location'), _('Unknown Location')