2021-03-15 10:48:59 +00:00
|
|
|
from djangoldp.serializers import LDPSerializer
|
2020-08-13 15:42:07 +00:00
|
|
|
from djangoldp.views import LDPViewSet
|
|
|
|
from djangoldp.pagination import LDPPagination
|
|
|
|
|
|
|
|
|
|
|
|
class LDPNotificationsPagination(LDPPagination):
|
2021-03-12 08:55:28 +00:00
|
|
|
default_limit = 80
|
2020-08-13 15:42:07 +00:00
|
|
|
|
|
|
|
|
2020-08-26 09:17:10 +00:00
|
|
|
class LDPNotificationsViewSet(LDPViewSet):
|
2020-08-13 15:42:07 +00:00
|
|
|
'''overridden LDPViewSet to force pagination'''
|
|
|
|
pagination_class = LDPNotificationsPagination
|
2020-11-28 19:16:29 +00:00
|
|
|
depth = 0
|
2021-03-15 10:48:59 +00:00
|
|
|
|
|
|
|
def update(self, request, *args, **kwargs):
|
|
|
|
instance = self.get_object()
|
|
|
|
|
|
|
|
LDPSerializer.to_representation_cache.invalidate(instance.user.urlid)
|
|
|
|
|
|
|
|
return super().update(request, *args, **kwargs)
|