Ejemplo n.º 1
0
    def get_context_data(self, **kwargs):
        application = get_object_or_404(Application, pk=self.args[0])
        if 'data' not in kwargs:
            kwargs['data'] = self._build_data(self.request, application)
        kwargs['id_request_form'] = IDRequestForm(application=application, officer=self.request.user)
        kwargs['returns_request_form'] = ReturnsRequestForm(application=application, officer=self.request.user)
        kwargs['amendment_request_form'] = AmendmentRequestForm(application=application, officer=self.request.user)
        kwargs['log_entry_form'] = ApplicationLogEntryForm(to=get_log_entry_to(application),
                                                           fromm=self.request.user.get_full_name())
        kwargs['application_declined_details_form'] = \
            ApplicationDeclinedDetailsForm(application=application, officer=self.request.user)

        return super(ProcessView, self).get_context_data(**kwargs)
Ejemplo n.º 2
0
 def _process_decline(self, application):
     request = self.request
     mutable = request.POST._mutable
     request.POST._mutable = True
     request.POST['application'] = application.pk
     request.POST._mutable = mutable
     if 'officer' not in request.POST:
         request.POST['officer'] = request.user.pk
     form = ApplicationDeclinedDetailsForm(request.POST)
     if form.is_valid():
         details = form.save()
         application.customer_status = 'declined'
         application.processing_status = 'declined'
         Assessment.objects.filter(application=application, status='awaiting_assessment'). \
             update(status='assessment_expired')
         application.save()
         application.log_user_action(
             ApplicationUserAction.ACTION_DECLINE_APPLICATION, request)
         recipient = send_application_declined_email(details, request)
         return True, "Application declined and email sent to {}".format(
             recipient)
     else:
         return False, str(form.errors)
Ejemplo n.º 3
0
 def _process_decline(self, application):
     request = self.request
     mutable = request.POST._mutable
     request.POST._mutable = True
     request.POST['application'] = application.pk
     request.POST._mutable = mutable
     if 'officer' not in request.POST:
         request.POST['officer'] = request.user.pk
     form = ApplicationDeclinedDetailsForm(request.POST)
     if form.is_valid():
         details = form.save()
         application.customer_status = 'declined'
         application.processing_status = 'declined'
         Assessment.objects.filter(application=application, status='awaiting_assessment'). \
             update(status='assessment_expired')
         application.save()
         application.log_user_action(
             ApplicationUserAction.ACTION_DECLINE_APPLICATION,
             request
         )
         recipient = send_application_declined_email(details, request)
         return True, "Application declined and email sent to {}".format(recipient)
     else:
         return False, str(form.errors)