def submit_action(self, instance): """ Submits a quota request email """ requested_quota = instance.request reason_for_request = instance.description username = self.request.user.username quota_request_email(self.request, username, requested_quota, reason_for_request)
def _email(self, request, username, new_quota, reason): """ Processes Increase Quota request. Sends email to [email protected] Returns a response. """ return quota_request_email(request, username, new_quota, reason)
def post(self, request): """ Creates a new Quota Request email and sends it to admins """ data = request.data required = ['quota', 'reason'] missing_keys = valid_post_data(data, required) if missing_keys: return keys_not_found(missing_keys) #Pass arguments username = request.user.username quota = data['quota'] reason = data['reason'] result = quota_request_email(request, username, quota, reason) return Response(result, status=status.HTTP_201_CREATED)