add pos device - fix closed quotas pagination
This commit is contained in:
@@ -268,6 +268,12 @@ class QuotaViewSet(viewsets.ModelViewSet): # noqa
|
||||
|
||||
return Response(status.HTTP_200_OK)
|
||||
|
||||
@action(
|
||||
methods=['patch'],
|
||||
)
|
||||
def activate(self, request):
|
||||
pass
|
||||
|
||||
@action(
|
||||
methods=['get'],
|
||||
detail=False,
|
||||
@@ -305,6 +311,7 @@ class QuotaViewSet(viewsets.ModelViewSet): # noqa
|
||||
""" list of organization closed quotas """
|
||||
|
||||
organization = get_organization_by_user(request.user)
|
||||
|
||||
# paginate queryset
|
||||
page = self.paginate_queryset(
|
||||
self.queryset.filter(
|
||||
@@ -412,26 +419,6 @@ class QuotaViewSet(viewsets.ModelViewSet): # noqa
|
||||
serializer = self.serializer_class(quotas, many=True).data
|
||||
return Response(serializer, status=status.HTTP_200_OK)
|
||||
|
||||
@action(
|
||||
methods=['get'],
|
||||
detail=False,
|
||||
url_path='closed_quotas',
|
||||
url_name='closed_quotas',
|
||||
name='closed_quotas'
|
||||
)
|
||||
def closed_quotas(self, request):
|
||||
""" get list of close quotas for organization """
|
||||
|
||||
quotas = quotas = self.queryset.filter(
|
||||
(Q(assigned_organizations=get_organization_by_user(request.user)) |
|
||||
Q(registerer_organization=get_organization_by_user(request.user))) &
|
||||
Q(is_closed=True)
|
||||
)
|
||||
|
||||
serialize = self.serializer_class(quotas, many=True).data
|
||||
|
||||
return Response(serialize, status=status.HTTP_200_OK)
|
||||
|
||||
@action(
|
||||
methods=['put'],
|
||||
detail=True,
|
||||
|
||||
Reference in New Issue
Block a user