from rest_framework.generics import ListAPIView, RetrieveAPIView
from apis_core.history.serializers import (
HistoryLogSerializer,
HistoryObjectSerializer,
)
[docs]
class EntityHistoryLogs(ListAPIView):
serializer_class = HistoryLogSerializer
[docs]
def get_queryset(self):
return (
self.kwargs.get("contenttype")
.model_class()
.history.filter(id=self.kwargs.get("pk"))
)
[docs]
class GenericHistoryLog(RetrieveAPIView):
serializer_class = HistoryObjectSerializer
[docs]
def get_queryset(self):
return self.kwargs.get("contenttype").model_class().objects.all()