Allow to customize prefetch behavior in UpdateModelMixin #9922
Unanswered
maingoh
asked this question in
Ideas & Suggestions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I would like to prefetch the related objects of an updated instance. For this purpose I added a
prefetch_related_objectsin theserializer.save(). However theUpdateModelMixinsilently clear it right after.I suggest moving those two lines in
serializer.save()by defaultdjango-rest-framework/rest_framework/mixins.py
Lines 70 to 73 in f222c55
Currently if I want to do this, I need to copy paste the content of
UpdateModelMixin.update()in myModelViewSetand replace this if with my prefetchs.Beta Was this translation helpful? Give feedback.
All reactions