Closed sommelon closed 2 years ago
You are very right, it's a bug, I forgot to include instance.save()
after updating an instance. The line you mentioned is the reason for a bug as well as this one. A temporary set was tricking tests :smile: that's why it was hard to hunt it down unless you recheck by sending a subsequent GET
request as you did in your test.
Thank you very much for reporting this and taking your time to go through the source code to look for the problem.
When I'm trying to update an object (
Course
) by creating a new nested object (Instructor
), the created object is returned in the initial response to thePATCH
request, but on a subsequentGET
request, the nested object is stillnull
. This is my test caseThis line in the source code patches the parent object, but the parent itself is not saved. That explains the presence of the nested object in the response to the initial request. Tested with
PUT
andPATCH
and the result is the same.Not sure if a simple
instance.save()
after the line would be a proper fix.