def form_valid(self, form): sender = self.request.user action = self.get_object() #recipient = form.cleaned_data['referrer'] recipient = action.referrers message = form.cleaned_data['message_text'] request_type = consts.REQUEST_TYPE_MESSAGE sender.assert_can_send_action_message(sender, recipient, action ) action_request = ActionRequest( action=action, sender=sender, request_notes=message, request_type=request_type ) action_request.save() action_request.recipient_set.add(*recipient) action_request.save() action_message_sent.send(sender=action_request) success_url = action.get_absolute_url() return views_support.response_redirect(self.request, success_url)
def form_valid(self, form): sender = self.request.user action = self.get_object() message = form.cleaned_data['request_text'] status = form.cleaned_data['status_to_set'] if status in (a_consts.ACTION_STATUS_VICTORY,): request_type = consts.REQUEST_TYPE_SET_VICTORY elif status in (a_consts.ACTION_STATUS_CLOSED,): request_type = consts.REQUEST_TYPE_SET_CLOSURE sender.assert_can_ask_action_status_update( action, request_type ) action_request = ActionRequest( action=action, sender=sender, request_notes=message, request_type=request_type ) action_request.save() success_url = action.get_absolute_url() return views_support.response_redirect(self.request, success_url)
def form_valid(self, form): sender = self.request.user action = self.get_object() recipient = form.cleaned_data['follower'] request_notes = form.cleaned_data['request_text'] request_type = consts.REQUEST_TYPE_MODERATION sender.assert_can_request_moderation_for_action(sender, recipient, action) #print("RECIPIENT: %s", recipient) action_request = ActionRequest( action=action, sender=sender, request_notes=request_notes, request_type=request_type ) action_request.save() action_request.recipient_set.add(recipient) action_request.save() action_moderation_request_submitted.send(sender=action_request) success_url = action.get_absolute_url() return views_support.response_redirect(self.request, success_url)
def form_valid(self, form): sender = self.request.user action = self.get_object() message = form.cleaned_data['request_text'] status = form.cleaned_data['status_to_set'] if status in (a_consts.ACTION_STATUS_VICTORY, ): request_type = consts.REQUEST_TYPE_SET_VICTORY elif status in (a_consts.ACTION_STATUS_CLOSED, ): request_type = consts.REQUEST_TYPE_SET_CLOSURE sender.assert_can_ask_action_status_update(action, request_type) action_request = ActionRequest(action=action, sender=sender, request_notes=message, request_type=request_type) action_request.save() success_url = action.get_absolute_url() return views_support.response_redirect(self.request, success_url)
def form_valid(self, form): sender = self.request.user action = self.get_object() #recipient = form.cleaned_data['referrer'] recipient = action.referrers message = form.cleaned_data['message_text'] request_type = consts.REQUEST_TYPE_MESSAGE sender.assert_can_send_action_message(sender, recipient, action) action_request = ActionRequest(action=action, sender=sender, request_notes=message, request_type=request_type) action_request.save() action_request.recipient_set.add(*recipient) action_request.save() action_message_sent.send(sender=action_request) success_url = action.get_absolute_url() return views_support.response_redirect(self.request, success_url)
def form_valid(self, form): sender = self.request.user action = self.get_object() recipient = form.cleaned_data['follower'] request_notes = form.cleaned_data['request_text'] request_type = consts.REQUEST_TYPE_MODERATION sender.assert_can_request_moderation_for_action( sender, recipient, action) #print("RECIPIENT: %s", recipient) action_request = ActionRequest(action=action, sender=sender, request_notes=request_notes, request_type=request_type) action_request.save() action_request.recipient_set.add(recipient) action_request.save() action_moderation_request_submitted.send(sender=action_request) success_url = action.get_absolute_url() return views_support.response_redirect(self.request, success_url)