Exemplo n.º 1
0
 def get_context_data(self, **kwargs):
     context = super().get_context_data(**kwargs)
     context["test_plan"] = plan_from_request_or_none(self.request)
     context["notify_formset"] = kwargs.get(
         "notify_formset") or CaseNotifyFormSet()
     context["templates"] = Template.objects.all()
     return context
Exemplo n.º 2
0
    def form_valid(self, form):
        notify_formset = CaseNotifyFormSet(self.request.POST, instance=self.object)
        if notify_formset.is_valid():
            notify_formset.save()
            return super().form_valid(form)

        # taken from FormMixin.form_invalid()
        return self.render_to_response(self.get_context_data(notify_formset=notify_formset))
Exemplo n.º 3
0
    def form_valid(self, form):
        test_plan = plan_from_request_or_none(self.request)

        notify_formset = CaseNotifyFormSet(self.request.POST)
        if notify_formset.is_valid():
            test_case = form.save()
            if test_plan:
                test_plan.add_case(test_case)

            notify_formset.instance = test_case
            notify_formset.save()

            return HttpResponseRedirect(reverse('testcases-get', args=[test_case.pk]))

        # taken from FormMixin.form_invalid()
        return self.render_to_response(self.get_context_data(notify_formset=notify_formset))
Exemplo n.º 4
0
 def get_context_data(self, **kwargs):
     context = super().get_context_data(**kwargs)
     context['test_plan'] = plan_from_request_or_none(self.request)
     context['notify_formset'] = kwargs.get('notify_formset') or CaseNotifyFormSet()
     return context
Exemplo n.º 5
0
 def get_context_data(self, **kwargs):
     context = super().get_context_data(**kwargs)
     context['notify_formset'] = kwargs.get('notify_formset') or \
         CaseNotifyFormSet(instance=self.object)
     return context