-
-
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
Fixed #3674 -- Refactored _get_reverse_relationships() to use correct to_field. #3852
Conversation
…eld instead of current object's
…ship is reverse vs forward to ensure correct field checking
…xist Conflicts: tests/test_model_serializer.py
geez you're on fire 🔥 😄 |
@jpadilla trying to get things moving. ATM Travis is on fire |
Otherwise we'll get a conflict between tests.test_model_serializer.ParentModel and tests.test_multitable_inheritance.ParentModel.
And there we are. |
LGTM 👍 |
👍 as well; I was the original reporter of this issue and can verify that it works for me. :) |
Closes #3674. |
field_kwargs['slug_field'] = to_field | ||
field_class = self.serializer_related_to_field | ||
if relation_info.reverse: | ||
if to_field and not relation_info.related_model_field.related_fields[0][1].primary_key: |
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.
Any idea what the [0][1]
refers to 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.
I will need to go back in and check what the actual values are. I really should have put a comment in there when I made the change. I'm pretty sure it's grabbing the to_field
value for the related field (see the relevant django code here) but you are totally right, it is very hard to decipher just by looking at 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.
related_fields[0]
is the first field in the model's from_fields
list; it's a tuple of (from_field, to_field)
so [1]
here is referring to to_field
overtakes #3696 (thanks to @benred42) !