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
4ce4132e
Commit
4ce4132e
authored
Jan 14, 2015
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Preserve ordering on relationship drop-down choices. Closes #2408.
parent
41e13d73
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
rest_framework/relations.py
+3
-2
No files found.
rest_framework/relations.py
View file @
4ce4132e
...
...
@@ -7,6 +7,7 @@ from django.utils import six
from
django.utils.encoding
import
smart_text
from
django.utils.six.moves.urllib
import
parse
as
urlparse
from
django.utils.translation
import
ugettext_lazy
as
_
from
rest_framework.compat
import
OrderedDict
from
rest_framework.fields
import
get_attribute
,
empty
,
Field
from
rest_framework.reverse
import
reverse
from
rest_framework.utils
import
html
...
...
@@ -103,7 +104,7 @@ class RelatedField(Field):
@property
def
choices
(
self
):
return
d
ict
([
return
OrderedD
ict
([
(
six
.
text_type
(
self
.
to_representation
(
item
)),
six
.
text_type
(
item
)
...
...
@@ -364,7 +365,7 @@ class ManyRelatedField(Field):
(
item
,
self
.
child_relation
.
to_representation
(
item
))
for
item
in
iterable
]
return
d
ict
([
return
OrderedD
ict
([
(
six
.
text_type
(
item_representation
),
six
.
text_type
(
item
)
+
' - '
+
six
.
text_type
(
item_representation
)
...
...
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