Coverage for apis_core/history/api_views.py: 80%
10 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-22 07:51 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-22 07:51 +0000
1from rest_framework.generics import ListAPIView, RetrieveAPIView
3from apis_core.history.serializers import (
4 HistoryLogSerializer,
5 HistoryObjectSerializer,
6)
9class EntityHistoryLogs(ListAPIView):
10 serializer_class = HistoryLogSerializer
12 def get_queryset(self):
13 return (
14 self.kwargs.get("contenttype")
15 .model_class()
16 .history.filter(id=self.kwargs.get("pk"))
17 )
20class GenericHistoryLog(RetrieveAPIView):
21 serializer_class = HistoryObjectSerializer
23 def get_queryset(self):
24 return self.kwargs.get("contenttype").model_class().objects.all()