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
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