aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/routers.py
diff options
context:
space:
mode:
authorErik Wickstrom2014-10-20 08:47:45 -0700
committerErik Wickstrom2014-10-20 08:47:45 -0700
commit674855a114cca8afbcd7a9927170d0d420aea819 (patch)
tree1e92ed3c2ab24570b3723ae18e413afc416eae97 /rest_framework/routers.py
parent12b677039d5485afa7bc913a6f56c4b107fbbe3f (diff)
downloaddjango-rest-framework-674855a114cca8afbcd7a9927170d0d420aea819.tar.bz2
Used Django utils SortedDict instead of stdlib's OrderedDict for
wider compatability.
Diffstat (limited to 'rest_framework/routers.py')
-rw-r--r--rest_framework/routers.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/rest_framework/routers.py b/rest_framework/routers.py
index 9937566d..169e6e8b 100644
--- a/rest_framework/routers.py
+++ b/rest_framework/routers.py
@@ -16,10 +16,11 @@ For example, you might have a `urls.py` that looks something like this:
from __future__ import unicode_literals
import itertools
-from collections import namedtuple, OrderedDict
+from collections import namedtuple
from django.conf.urls import patterns, url
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import NoReverseMatch
+from django.utils.datastructures import SortedDict
from rest_framework import views
from rest_framework.response import Response
from rest_framework.reverse import reverse
@@ -277,7 +278,7 @@ class DefaultRouter(SimpleRouter):
"""
Return a view to use as the API root.
"""
- api_root_dict = OrderedDict()
+ api_root_dict = SortedDict()
list_name = self.routes[0].name
for prefix, viewset, basename in self.registry:
api_root_dict[prefix] = list_name.format(basename=basename)
@@ -286,7 +287,7 @@ class DefaultRouter(SimpleRouter):
_ignore_model_permissions = True
def get(self, request, *args, **kwargs):
- ret = OrderedDict()
+ ret = SortedDict()
for key, url_name in api_root_dict.items():
try:
ret[key] = reverse(