Example #1
0
 def datatable_list(self, request, *args, **kwargs):
     try:
         qs = self.get_queryset()
         serializer = OrganisationRequestDTSerializer(qs, many=True)
         return Response(serializer.data)
     except serializers.ValidationError:
         print(traceback.print_exc())
         raise
     except ValidationError as e:
         print(traceback.print_exc())
         raise serializers.ValidationError(repr(e.error_dict))
     except Exception as e:
         print(traceback.print_exc())
         raise serializers.ValidationError(str(e))
Example #2
0
 def get_amendment_requested_requests(self, request, *args, **kwargs):
     try:
         qs = self.get_queryset().filter(requester=request.user,
                                         status='amendment_requested')
         serializer = OrganisationRequestDTSerializer(qs, many=True)
         return Response(serializer.data)
     except serializers.ValidationError:
         print(traceback.print_exc())
         raise
     except ValidationError as e:
         print(traceback.print_exc())
         raise serializers.ValidationError(repr(e.error_dict))
     except Exception as e:
         print(traceback.print_exc())
         raise serializers.ValidationError(str(e))
Example #3
0
 def pending_org_requests(self, request, *args, **kwargs):
     try:
         instance = self.get_object()
         serializer = OrganisationRequestDTSerializer(
             instance.organisationrequest_set.filter(
                 status='with_assessor'),
             many=True,
             context={'request': request})
         return Response(serializer.data)
     except serializers.ValidationError:
         print(traceback.print_exc())
         raise
     except ValidationError as e:
         print(traceback.print_exc())
         raise serializers.ValidationError(repr(e.error_dict))
     except Exception as e:
         print(traceback.print_exc())
         raise serializers.ValidationError(str(e))