Skip to content
Snippets Groups Projects
Commit d26820c4 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

TMSS-207: return the normal list of urls, but then sorted by url so they are...

TMSS-207: return the normal list of urls, but then sorted by url so they are easier to find in a list for us humble humans
parent ed5f4b7e
No related branches found
No related tags found
1 merge request!175Resolve TMSS-207
......@@ -20,6 +20,7 @@ from django.urls import path, re_path
from django.conf.urls import url, include
from django.views.generic.base import TemplateView
from collections import OrderedDict
from rest_framework import routers, permissions
from .tmssapp import viewsets, models, serializers, views
from rest_framework.documentation import include_docs_urls
......@@ -60,7 +61,21 @@ urlpatterns = [
# REST Router
#
class TMSSAPIRootView(routers.APIRootView):
def get(self, request, *args, **kwargs):
'''return the normal list of urls, but then sorted by url so they are easier to find in a list for us humble humans'''
response = super().get(request, *args, **kwargs)
sorted_by_key_urls = OrderedDict()
for key in sorted(response.data.keys()):
sorted_by_key_urls[key] = response.data[key]
response.data = sorted_by_key_urls
return response
router = routers.DefaultRouter()
router.APIRootView = TMSSAPIRootView
router.register(r'tags', viewsets.TagsViewSet)
# SPECIFICATION
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment