list of organizations by province - some changes in quota an models of that
This commit is contained in:
@@ -188,7 +188,6 @@ class OrganizationViewSet(ModelViewSet):
|
||||
""" Crud operations for organization model """ #
|
||||
queryset = Organization.objects.all()
|
||||
serializer_class = OrganizationSerializer
|
||||
permission_classes = [auth_permissions.CreateOrganization]
|
||||
|
||||
@transaction.atomic
|
||||
def create(self, request, *args, **kwargs):
|
||||
@@ -217,6 +216,24 @@ class OrganizationViewSet(ModelViewSet):
|
||||
else:
|
||||
return Response(serializer.errors, status=status.HTTP_406_NOT_ACCEPTABLE)
|
||||
|
||||
@action(
|
||||
methods=['get'],
|
||||
detail=False,
|
||||
url_path='organizations_by_province',
|
||||
url_name='organizations_by_province',
|
||||
name='organizations_by_province'
|
||||
)
|
||||
@transaction.atomic
|
||||
def get_organizations_by_province(self, request):
|
||||
""" list of organizations by province """
|
||||
|
||||
serializer = self.serializer_class(
|
||||
self.queryset.filter(
|
||||
province=int(request.GET['province'])),
|
||||
many=True
|
||||
)
|
||||
return Response(serializer.data, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class BankAccountViewSet(ModelViewSet):
|
||||
""" Crud operations for bank account model """ #
|
||||
|
||||
Reference in New Issue
Block a user