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
15a386e8
Commit
15a386e8
authored
Jun 22, 2015
by
Tom Christie
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3045 from paxnovem/issue_3042
Fixed many=False issue on related fields
parents
894aa9b4
51cda112
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
0 deletions
+6
-0
rest_framework/relations.py
+1
-0
tests/test_relations.py
+5
-0
No files found.
rest_framework/relations.py
View file @
15a386e8
...
...
@@ -42,6 +42,7 @@ class RelatedField(Field):
'Relational fields should not provide a `queryset` argument, '
'when setting read_only=`True`.'
)
kwargs
.
pop
(
'many'
,
None
)
super
(
RelatedField
,
self
)
.
__init__
(
**
kwargs
)
def
__new__
(
cls
,
*
args
,
**
kwargs
):
...
...
tests/test_relations.py
View file @
15a386e8
...
...
@@ -48,6 +48,11 @@ class TestPrimaryKeyRelatedField(APISimpleTestCase):
representation
=
self
.
field
.
to_representation
(
self
.
instance
)
assert
representation
==
self
.
instance
.
pk
def
test_explicit_many_false
(
self
):
field
=
serializers
.
PrimaryKeyRelatedField
(
queryset
=
self
.
queryset
,
many
=
False
)
instance
=
field
.
to_internal_value
(
self
.
instance
.
pk
)
assert
instance
is
self
.
instance
class
TestProxiedPrimaryKeyRelatedField
(
APISimpleTestCase
):
def
setUp
(
self
):
...
...
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