mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-06 05:20:12 +03:00
Invalidate any existing prefetch cache on PUT requests.
This commit is contained in:
parent
388cf7622c
commit
384f3a0240
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user