djangoldp-notification/djangoldp_notification/views.py

21 lines
591 B
Python
Raw Normal View History

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
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)