Esempio n. 1
0
 def post(self, request, requestion):
     form = RegistrationDateTimeForm(instance=requestion, data=request.POST)
     confirmation_form = BaseConfirmationForm(data=request.POST)
     if form.is_valid() and confirmation_form.is_valid():
         if form.has_changed():
             requestion = form.save()
             messages.info(
                 request, u'Дата регистрации была изменена на {}'.format(
                     date_format(requestion.registration_datetime,
                                 "SHORT_DATETIME_FORMAT")))
             context_dict = {
                 'registration_datetime': requestion.registration_datetime}
             Logger.objects.create_for_action(
                 CHANGE_REGISTRATION_DATETIME, context_dict=context_dict,
                 extra={'user': request.user, 'obj': requestion},
                 reason=confirmation_form.cleaned_data.get('reason'))
         else:
             msg = u'Дата регистрации заявки {} осталась без изменений'
             messages.info(request, msg.format(requestion.requestion_number))
         return HttpResponseRedirect(
             reverse('supervisor_requestion_info',
                     kwargs={'requestion_id': requestion.id}))
     else:
         return self.render_to_response({
             'form': form, 'requestion': requestion,
             'confirmation_form': confirmation_form})
Esempio n. 2
0
    def post(self, request, requestion, profile):

        form = BaseConfirmationForm(request.POST)
        if form.is_valid():
            reason = form.cleaned_data.get("reason")
            requestion.embed_requestion_to_profile(profile, request.user, reason)
            messages.info(request, u"Заявка %s была прикреплена к профилю" % requestion.requestion_number)
            return HttpResponseRedirect(reverse("operator_requestion_info", kwargs={"requestion_id": requestion.id}))
        context = self.get_context_data(requestion=requestion, profile=profile)
        context.update({"form": form})
        return self.render_to_response(context)
Esempio n. 3
0
 def post(self, request, requestion):
     form = BirthDateForm(instance=requestion, data=request.POST)
     confirmation_form = BaseConfirmationForm(data=request.POST)
     if form.is_valid() and confirmation_form.is_valid():
         if form.has_changed():
             requestion = form.save()
             messages.info(request, u"Дата рождения заявки {} была изменена".format(requestion.requestion_number))
             context_dict = {"birth_date": requestion.birth_date}
             Logger.objects.create_for_action(
                 CHANGE_BIRTHDATE,
                 context_dict=context_dict,
                 extra={"user": request.user, "obj": requestion},
                 reason=confirmation_form.cleaned_data.get("reason"),
             )
         else:
             msg = u"Дата рождения заявки {} осталась без изменений"
             messages.info(request, msg.format(requestion.requestion_number))
         return HttpResponseRedirect(reverse("supervisor_requestion_info", kwargs={"requestion_id": requestion.id}))
     return self.render_to_response({"form": form, "requestion": requestion, "confirmation_form": confirmation_form})
Esempio n. 4
0
 def post(self, request, requestion):
     form = BirthDateForm(instance=requestion, data=request.POST)
     confirmation_form = BaseConfirmationForm(data=request.POST)
     if form.is_valid() and confirmation_form.is_valid():
         if form.has_changed():
             requestion = form.save()
             messages.info(request,
                 u'Дата рождения заявки %s была изменена' %
                     requestion.requestion_number)
             context_dict = {'birth_date': requestion.birth_date}
             Logger.objects.create_for_action(CHANGE_BIRTHDATE,
                 context_dict=context_dict,
                 extra={'user': request.user, 'obj': requestion}, reason=confirmation_form.cleaned_data.get('reason'))
         else:
             messages.info(request,
                 u'Дата регистрации заявки %s осталась без изменений' %
                     requestion.requestion_number)
         return HttpResponseRedirect(reverse('supervisor_requestion_info',
             kwargs={'requestion_id': requestion.id}))
     return self.render_to_response({'form': form, 'requestion':requestion, 'confirmation_form': confirmation_form})