Exemplo n.º 1
0
    def get_queryset(self):
        service = CalipsoAvailableImagesServices()

        username = self.kwargs.get('username')
        if username == self.request.user.username:
            return service.get_sum_containers_quota(username=username)
        else:
            raise PermissionDenied
Exemplo n.º 2
0
 def get(self, *args, **kwargs):
     service = CalipsoAvailableImagesServices()
     username = self.kwargs.get('username')
     if username == self.request.user.username:
         quota = service.get_sum_containers_quota(username=username)
         serializer_class = CalipsoUserQuotaSerializer(quota)
         return Response(serializer_class.data)
     else:
         raise PermissionDenied