-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Respect to_field property of ForeignKey relations #2435
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
Closed
Closed
Changes from 1 commit
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
* Removed 2 unnecessary lines
- Loading branch information
commit 6369f93d041e1879ca8ef05f0fd8fe4875fc9360
There are no files selected for viewing
This file contains hidden or 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.
The primary key may not be named
'id'so I'm unsure about this.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.
Please see 2 (outdated diffs) above
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.
Can you add some clarification on this? The comment is a bit vauge about what the issue actually is, though I assume it has to do with
AutoFieldconsidering it involves theidfield?I understand the point of doing
if to_field, not the additional check though.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 think it also has to do with what gets into that to_field and makes it to that point. I would remove any 'id' entries in compat/get_to_field making this check here unnecessary. Maybe not the best solution but the to_field irritates me for now. I think for plain ForeignKeys it is safe but for anything else... i dont know.
I added some links to the core issue of that 2 posts above. Thats what i meant.