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
Nested objects not deserialized when many=True
during PUT requests
#960
Comments
I believe this is fixed with #750. Can you perhaps take a look and verify? |
Specifically this line https://github.com/tomchristie/django-rest-framework/pull/750/files#L1R383. |
Thanks @maspwr the line you've pointed me to seems perfect, I will try your pull-request right now and let you know of the result. |
Great! Let me know if you have any issues. Also, if you find any problems with that pull request, please do respond to it and I'll try to address them. It's great to get some more testing on it before it gets merged. |
That's working ! Great work :) When I do the PUT request mentioned above in my initial error $ http -v PUT http://localhost:8000/api/albums/2/ songs:='[{"title":"Imagine"}]' I'm getting a Then, when I'm trying to update an exisiting item with this request $ http -v PUT http://localhost:8000/api/albums/2/ songs:='[{"id":6, "title":"Imagine version 2"}]' That is perfectly working! The last test I've to run, is with the new routing feature of $ http -v POST http://localhost:8000/api/albums/2/songs/ title="Dig a Pony" But that's out of the scope of the nested objects pull-request Well to sum up, I will close my issue since it's fixed by #750 |
The error is raised when I'm submitting the following request thanks to the httpie command on an existing album :
$ http -v PUT http://localhost:8000/api/albums/2/ songs:='[{"title":"Imagine"}]'
Whereas, a POST request is working perfectly, like this one
I've track down the error to be that the variable
instance
is an instance ofdjango.db.models.fields.related.RelatedManager
that is not judged as an iterable object by default... it's only iterable after calling theall
method.Whereas, for the POST request, this same variable
instance
is set toNone
.I didn't find a fix for it yet, but I'll make a PR as soon as I do.
version of django-rest-framework:
2.3.6
My Serializers
My Views
Full error traceback
The text was updated successfully, but these errors were encountered: