-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Respect to_field property of ForeignKey relations #2435
Closed
Closed
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
067360c
Added support for the to_field on ForeignKey Fields.
Harper04 8263048
* many to many relationship do not have to_fields
Harper04 d47f29a
Fixed the rest of the test cases.
Harper04 49ecaa7
Add support for Django <1.6 where appearently no to_field existed
Harper04 6369f93
* Removed 2 unnecessary lines
Harper04 6007463
Merge branch 'master' of https://github.com/tomchristie/django-rest-f…
Harper04 f808b6c
* Removed SlugRelatedField optimization
Harper04 77eeefa
Merge branch 'master' of https://github.com/tomchristie/django-rest-f…
Harper04 3dd5ddd
Merge branch 'master' of https://github.com/tomchristie/django-rest-f…
Harper04 6ccc45e
Ups. Removed the wrong line. (optimizer)
Harper04 64c49f8
From this i believe it is field_name pre django 1.6. I still don’t ha…
Harper04 a496c52
to_field is rel.field_name at <1.6. love pdb and pip!
Harper04 8096997
Merge branch 'master' of https://github.com/tomchristie/django-rest-f…
Harper04 54e16f4
Merge branch 'master' into model-tofield-serializer
Harper04 5ca9841
* updated patch to latest DRF revision
Harper04 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be
kwargs['slug_field'] = to_field
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's being used in
serializers.py
with the check againstid
. If we determine that the check isn't actually needed, then I think we could get away with just usingslug_field
here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I didn't understand - you might need to link me to that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/tomchristie/django-rest-framework/pull/2435/files#diff-80f43677c94659fbd60c8687cce68eafR1007 and the line with your comment below it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I named it to_field because mentally i am still treating it like a ForeignKey object at that point. Pointing it to a slug_field afterwards was just handy