def form_valid(self, form):
     """If no errors, check for warnings, redirect to confirmation if needed
     """
     if form.warnings:
         self.log_page_completion_and_save_data(form)
         MessagesService.flash_warnings(self.request, WARNING_FLASH_MESSAGE)
         return redirect(reverse('intake-confirm'))
     return super().form_valid(form)
Esempio n. 2
0
 def form_valid(self, form):
     """If no errors, check for warnings, redirect to confirmation if needed
     """
     if form.warnings:
         self.log_page_completion_and_save_data(form)
         MessagesService.flash_warnings(self.request, WARNING_FLASH_MESSAGE)
         return redirect(reverse('intake-confirm'))
     return super().form_valid(form)
Esempio n. 3
0
 def get_context_data(self, *args, **kwargs):
     context = super().get_context_data(*args, **kwargs)
     editing_scope = self.request.GET.get('editing', '')
     if editing_scope:
         MessagesService.flash_warnings(
             self.request,
             _("You can edit your answers to any questions on this "
               "page, if you need to."))
     field_to_edit = context['form'].fields.get(editing_scope, None)
     if field_to_edit:
         field_to_edit.add_warning(
             _("You wanted to edit your answer to this question."),
             key=editing_scope)
     return context
 def get_context_data(self, *args, **kwargs):
     context = super().get_context_data(*args, **kwargs)
     editing_scope = self.request.GET.get('editing', '')
     if editing_scope:
         MessagesService.flash_warnings(
             self.request,
             _(
                 "You can edit your answers to any questions on this "
                 "page, if you need to."))
     field_to_edit = context['form'].fields.get(editing_scope, None)
     if field_to_edit:
         field_to_edit.add_warning(
             _("You wanted to edit your answer to this question."),
             key=editing_scope)
     return context