Ejemplo n.º 1
0
 def post(self, request, *args, **kwargs):
     ota_enrollment_form = OTAEnrollmentForm(request.POST, prefix="oe")
     ota_enrollment_secret_form = OTAEnrollmentSecretForm(request.POST, prefix="oes")
     if ota_enrollment_form.is_valid() and ota_enrollment_secret_form.is_valid():
         ota_enrollment = ota_enrollment_form.save(commit=False)
         ota_enrollment.enrollment_secret = ota_enrollment_secret_form.save()
         ota_enrollment.save()
         return HttpResponseRedirect(reverse("mdm:ota_enrollment",
                                             args=(ota_enrollment.pk,)))
     else:
         return self.render_to_response(
             self.get_context_data(ota_enrollment_form=ota_enrollment_form,
                                   ota_enrollment_secret_form=ota_enrollment_secret_form)
         )
Ejemplo n.º 2
0
 def post(self, request, *args, **kwargs):
     ota_enrollment_form = OTAEnrollmentForm(request.POST, prefix="oe")
     enrollment_secret_form = EnrollmentSecretForm(request.POST,
                                                   prefix="es")
     if ota_enrollment_form.is_valid() and enrollment_secret_form.is_valid(
     ):
         ota_enrollment = ota_enrollment_form.save(commit=False)
         ota_enrollment.enrollment_secret = enrollment_secret_form.save()
         enrollment_secret_form.save_m2m()
         ota_enrollment.save()
         return redirect(ota_enrollment)
     else:
         return self.render_to_response(
             self.get_context_data(
                 ota_enrollment_form=ota_enrollment_form,
                 enrollment_secret_form=enrollment_secret_form))
Ejemplo n.º 3
0
 def post(self, request, *args, **kwargs):
     ota_enrollment_form = OTAEnrollmentForm(request.POST, prefix="oe")
     enrollment_secret_form = EnrollmentSecretForm(
         request.POST,
         prefix="es",
         meta_business_unit=self.meta_business_unit,
     )
     if ota_enrollment_form.is_valid() and enrollment_secret_form.is_valid():
         ota_enrollment = ota_enrollment_form.save(commit=False)
         ota_enrollment.enrollment_secret = enrollment_secret_form.save()
         enrollment_secret_form.save_m2m()
         ota_enrollment.save()
         return HttpResponseRedirect(ota_enrollment.get_absolute_url())
     else:
         return self.render_to_response(
             self.get_context_data(ota_enrollment_form=ota_enrollment_form,
                                   enrollment_secret_form=enrollment_secret_form)
         )
Ejemplo n.º 4
0
 def get_context_data(self, **kwargs):
     ota_enrollment_form = kwargs.get("ota_enrollment_form")
     if not ota_enrollment_form:
         ota_enrollment_form = OTAEnrollmentForm(prefix="oe")
     ota_enrollment_secret_form = kwargs.get("ota_enrollment_secret_form")
     if not ota_enrollment_secret_form:
         ota_enrollment_secret_form = OTAEnrollmentSecretForm(prefix="oes")
     return {"setup": True,
             "ota_enrollment_form": ota_enrollment_form,
             "ota_enrollment_secret_form": ota_enrollment_secret_form}
Ejemplo n.º 5
0
 def get_context_data(self, **kwargs):
     context = super().get_context_data(**kwargs)
     ota_enrollment_form = kwargs.get("ota_enrollment_form")
     if not ota_enrollment_form:
         ota_enrollment_form = OTAEnrollmentForm(prefix="oe")
     context["ota_enrollment_form"] = ota_enrollment_form
     enrollment_secret_form = kwargs.get("enrollment_secret_form")
     if not enrollment_secret_form:
         enrollment_secret_form = EnrollmentSecretForm(prefix="es")
     context["enrollment_secret_form"] = enrollment_secret_form
     return context
Ejemplo n.º 6
0
 def get_context_data(self, **kwargs):
     context = super().get_context_data(**kwargs)
     context["mdm"] = True
     context["meta_business_unit"] = self.meta_business_unit
     ota_enrollment_form = kwargs.get("ota_enrollment_form")
     if not ota_enrollment_form:
         ota_enrollment_form = OTAEnrollmentForm(prefix="oe")
     context["ota_enrollment_form"] = ota_enrollment_form
     enrollment_secret_form = kwargs.get("enrollment_secret_form")
     if not enrollment_secret_form:
         enrollment_secret_form = EnrollmentSecretForm(
             prefix="es",
             meta_business_unit=self.meta_business_unit,
         )
     context["enrollment_secret_form"] = enrollment_secret_form
     return context