-
Notifications
You must be signed in to change notification settings - Fork 160
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
'parent_pk' KeyError when posting/putting to a nested url #313
Comments
I have the same issue, once you get past the first level of nesting |
@JayCeeJr Unfortunately I did not. However I moved to using drf-nested-resources as a working alternative, which solved my issue. Make sure to read my closed issue in that repo tho, you may run in the same issue that I encountered there. |
it's not maintained for 5 years now :/ |
Yeah that's unfortunate; good thing is it still works for me. |
I have the following two simplified models:
With serializers:
With viewsets:
and finally urls:
Everything works fine, I can GET
http://localhost/relays/8/logs/
andhttp://localhost/relays/8/logs/16
to list and show detail for the specific relay logs, respectively.However, when looking at
http://localhost/relays/8/logs/
and try to post a new relay log, or when looking athttp://localhost/relays/8/logs/14
and try to PUT to change some fields on it, I get aKeyError at /relays/8/logs/ 'parent_pk'
.After digging in the source code for a reason why there is
parent_pk
, it seems that it is somewhy forced intorelations.py - line 24
. Trying to remove the keyparent_pk
and its corresponding value seems to fix the issue.I'm not sure if I have misconfigured something or if the source code has a bug?
The text was updated successfully, but these errors were encountered: