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))
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))