Invalidate any existing prefetch cache on PUT requests.

This commit is contained in:
Tom Christie 2016-11-10 15:41:36 +00:00
parent 388cf7622c
commit 384f3a0240

View File

@ -71,9 +71,8 @@ class UpdateModelMixin(object):
if getattr(instance, '_prefetched_objects_cache', None):
# If 'prefetch_related' has been applied to a queryset, we need to
# refresh the instance from the database.
instance = self.get_object()
serializer = self.get_serializer(instance)
# forcibly invalidate the prefetch cache on the instance.
instance._prefetched_objects_cache = {}
return Response(serializer.data)