Esempio n. 1
0
 def post(self, request, *args, **kwargs):
     self.object = None
     form_class = self.get_form_class()
     form = self.get_form(form_class)
     opcion_formset = OpcionEjercicioVirtualFormSet(self.request.POST)
     if (form.is_valid() and opcion_formset.is_valid()):
         return self.form_valid(form, opcion_formset)
     else:
         return self.form_invalid(form, opcion_formset)
Esempio n. 2
0
 def post(self, request, *args, **kwargs):
     self.object = self.model.objects.filter(pk= self.kwargs['pk']).first()
     clase_virtual = models.ClaseVirtual.objects.get(pk= self.object.clase_virtual.id)
     form_class = self.get_form_class()
     form = self.get_form(form_class)
     form.instance.tipo_ejercicio = form.instance.MULTIPLE_CHOICE
     form.instance.clase_virtual = clase_virtual
     opcion_formset = OpcionEjercicioVirtualFormSet(self.request.POST, instance = self.object)
     if (form.is_valid() and opcion_formset.is_valid()):
         return self.form_valid(form, opcion_formset)
     else:
         return self.form_invalid(form, opcion_formset)