You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For the sake of simplicity, I'll be talking about Posts and Comments event though my models are different ones. This could be a duplicate of #1556, but it's closed and is about an outdated version of DRF.
Steps to reproduce
I created a PostViewSet and redefined the get_queryset method.
I'm trying to update the full Post object. For this I send a PUT request containing the post with its comments. I had to redefine the update method in the serializer to handle nested comments.
Expected behavior
The new comments are added to the post, the updated post is served back in the http response. With all updated fields, and updated comments.
Actual behavior
The new comments are indeed added to the post, but the returned item in the http response is the one BEFORE it was updated. Removing the prefetch_related solves the issue but I need it.
The text was updated successfully, but these errors were encountered:
For the sake of simplicity, I'll be talking about Posts and Comments event though my models are different ones. This could be a duplicate of #1556, but it's closed and is about an outdated version of DRF.
Steps to reproduce
I created a PostViewSet and redefined the get_queryset method.
I'm trying to update the full Post object. For this I send a PUT request containing the post with its comments. I had to redefine the update method in the serializer to handle nested comments.
Expected behavior
The new comments are added to the post, the updated post is served back in the http response. With all updated fields, and updated comments.
Actual behavior
The new comments are indeed added to the post, but the returned item in the http response is the one BEFORE it was updated. Removing the prefetch_related solves the issue but I need it.
The text was updated successfully, but these errors were encountered: