Coverage for api/mixins.py: 68%
13 statements
« prev ^ index » next coverage.py v6.4.4, created at 2023-09-27 19:23 -0600
« prev ^ index » next coverage.py v6.4.4, created at 2023-09-27 19:23 -0600
1from rest_framework.permissions import AllowAny
3from api.permissions import ProscaiPermissions
4from django_audit_log.rest_framework.viewsets import AuditLogViewSet
7class BaseMixin(AuditLogViewSet):
8 @property
9 def model(self):
10 """
11 Retrieve model used in serializer
12 """
13 return self.serializer_class.Meta.model
15 def get_queryset(self):
16 """
17 Get Only Organization Related objects
18 """
19 if self.queryset:
20 return self.queryset
21 return self.model.objects.all()
24class ProscaiMixin(BaseMixin):
25 permission_classes = [ProscaiPermissions]