Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
12b67703
Commit
12b67703
authored
Oct 19, 2014
by
Erik Wickstrom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Maintain order of views on router for api root view.
parent
09515233
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
rest_framework/routers.py
+3
-3
No files found.
rest_framework/routers.py
View file @
12b67703
...
@@ -16,7 +16,7 @@ For example, you might have a `urls.py` that looks something like this:
...
@@ -16,7 +16,7 @@ For example, you might have a `urls.py` that looks something like this:
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
import
itertools
import
itertools
from
collections
import
namedtuple
from
collections
import
namedtuple
,
OrderedDict
from
django.conf.urls
import
patterns
,
url
from
django.conf.urls
import
patterns
,
url
from
django.core.exceptions
import
ImproperlyConfigured
from
django.core.exceptions
import
ImproperlyConfigured
from
django.core.urlresolvers
import
NoReverseMatch
from
django.core.urlresolvers
import
NoReverseMatch
...
@@ -277,7 +277,7 @@ class DefaultRouter(SimpleRouter):
...
@@ -277,7 +277,7 @@ class DefaultRouter(SimpleRouter):
"""
"""
Return a view to use as the API root.
Return a view to use as the API root.
"""
"""
api_root_dict
=
{}
api_root_dict
=
OrderedDict
()
list_name
=
self
.
routes
[
0
]
.
name
list_name
=
self
.
routes
[
0
]
.
name
for
prefix
,
viewset
,
basename
in
self
.
registry
:
for
prefix
,
viewset
,
basename
in
self
.
registry
:
api_root_dict
[
prefix
]
=
list_name
.
format
(
basename
=
basename
)
api_root_dict
[
prefix
]
=
list_name
.
format
(
basename
=
basename
)
...
@@ -286,7 +286,7 @@ class DefaultRouter(SimpleRouter):
...
@@ -286,7 +286,7 @@ class DefaultRouter(SimpleRouter):
_ignore_model_permissions
=
True
_ignore_model_permissions
=
True
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
ret
=
{}
ret
=
OrderedDict
()
for
key
,
url_name
in
api_root_dict
.
items
():
for
key
,
url_name
in
api_root_dict
.
items
():
try
:
try
:
ret
[
key
]
=
reverse
(
ret
[
key
]
=
reverse
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment