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
544c24e7
Commit
544c24e7
authored
Nov 04, 2015
by
Tom Christie
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3593 from tomchristie/primary-key-check-for-to-field
Proper 'primary key' checking on to_fields.
parents
95f92e99
54b79db2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 additions
and
1 deletions
+1
-1
rest_framework/serializers.py
+1
-1
No files found.
rest_framework/serializers.py
View file @
544c24e7
...
...
@@ -1131,7 +1131,7 @@ class ModelSerializer(Serializer):
field_kwargs
=
get_relation_kwargs
(
field_name
,
relation_info
)
to_field
=
field_kwargs
.
pop
(
'to_field'
,
None
)
if
to_field
and
to_field
!=
'id'
:
if
to_field
and
not
relation_info
.
related_model
.
_meta
.
get_field
(
to_field
)
.
primary_key
:
field_kwargs
[
'slug_field'
]
=
to_field
field_class
=
self
.
serializer_related_to_field
...
...
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