Exemplo n.º 1
0
 def assign_request_user(self, request, *args, **kwargs):
     try:
         instance = self.get_object(requester =request.user)
         serializer = OrganisationRequestSerializer(instance)
         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))
Exemplo n.º 2
0
 def reupload_identification_amendment_request(self, request, *args, **kwargs):
     try:
         instance = self.get_object()
         instance.reupload_identification_amendment_request(request)
         serializer = OrganisationRequestSerializer(instance, partial=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))
Exemplo n.º 3
0
 def assign_to(self, request, *args, **kwargs):
     try:
         instance = self.get_object()
         user_id = request.data.get('user_id',None)
         user = None
         if not user_id:
             raise serializers.ValiationError('A user id is required')
         try:
             user = EmailUser.objects.get(id=user_id)
         except EmailUser.DoesNotExist:
             raise serializers.ValidationError('A user with the id passed in does not exist')
         instance.assign_to(user,request)
         serializer = OrganisationRequestSerializer(instance)
         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))