def agregar_admin(self): form_class = forms.EmpleadoRegisterForm data = {'nombre':'julian ruiz diaz' , 'dni':'36017874', 'email':'*****@*****.**', 'fechaNacimiento':'02/08/1992', 'domicilio':'General Vedia 417', 'telefono':'3624563539', 'contrasena':'1234NorteViejo', 'confirmar_contrasena':'1234NorteViejo'} form = form_class(data=data) form.is_valid() form.clean() functions.crear_perfil(form, 'admin')
def form_valid(self, form): crear_perfil(form, 'empleado') return super(EmpCreateView, self).form_valid(form)
def form_valid(self, form): crear_perfil(form, 'cliente') crear_historial_alta(form, self.request.user) self.object.fechaUpdate = corregir_fecha_update(self.object) self.object.save() return HttpResponseRedirect(self.get_success_url())
def form_valid(self, form): crear_perfil(form, 'admin') return super(AdminCreateView, self).form_valid(form)