From 1a4077cf632e2a0d3d622173a32eb2738ec28345 Mon Sep 17 00:00:00 2001 From: Calum Mackervoy Date: Mon, 15 Mar 2021 10:48:59 +0000 Subject: [PATCH] bugfix: clearing user cache on Notification update --- djangoldp_notification/views.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/djangoldp_notification/views.py b/djangoldp_notification/views.py index 420437e..5abd188 100644 --- a/djangoldp_notification/views.py +++ b/djangoldp_notification/views.py @@ -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)