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 getattr(instance, '_prefetched_objects_cache', None):
|
||||||
# If 'prefetch_related' has been applied to a queryset, we need to
|
# If 'prefetch_related' has been applied to a queryset, we need to
|
||||||
# refresh the instance from the database.
|
# forcibly invalidate the prefetch cache on the instance.
|
||||||
instance = self.get_object()
|
instance._prefetched_objects_cache = {}
|
||||||
serializer = self.get_serializer(instance)
|
|
||||||
|
|
||||||
return Response(serializer.data)
|
return Response(serializer.data)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user