bugfix: clearing user cache on Notification update

This commit is contained in:
Calum Mackervoy 2021-03-15 10:48:59 +00:00 committed by Jean-Baptiste Pasquier
parent 6db04e6e03
commit 1a4077cf63

View File

@ -1,3 +1,4 @@
from djangoldp.serializers import LDPSerializer
from djangoldp.views import LDPViewSet
from djangoldp.pagination import LDPPagination
@ -10,3 +11,10 @@ class LDPNotificationsViewSet(LDPViewSet):
'''overridden LDPViewSet to force pagination'''
pagination_class = LDPNotificationsPagination
depth = 0
def update(self, request, *args, **kwargs):
instance = self.get_object()
LDPSerializer.to_representation_cache.invalidate(instance.user.urlid)
return super().update(request, *args, **kwargs)