Coverage for apis_core/history/api_views.py: 80%

10 statements  

« prev     ^ index     » next       coverage.py v7.6.8, created at 2024-12-20 09:24 +0000

1from rest_framework.generics import ListAPIView, RetrieveAPIView 

2 

3from apis_core.history.serializers import ( 

4 HistoryLogSerializer, 

5 HistoryObjectSerializer, 

6) 

7 

8 

9class EntityHistoryLogs(ListAPIView): 

10 serializer_class = HistoryLogSerializer 

11 

12 def get_queryset(self): 

13 return ( 

14 self.kwargs.get("contenttype") 

15 .model_class() 

16 .history.filter(id=self.kwargs.get("pk")) 

17 ) 

18 

19 

20class GenericHistoryLog(RetrieveAPIView): 

21 serializer_class = HistoryObjectSerializer 

22 

23 def get_queryset(self): 

24 return self.kwargs.get("contenttype").model_class().objects.all()