def add_user(request): if request.method == 'POST': formulario = UserCreateForm(request.POST) if formulario.is_valid: formulario.save() userNuevo = User.objects.get(username=request.POST['username']) profileUser = Profile.objects.get(id='3') objetoUser = Userprofile.objects.create(user_id=userNuevo.id,name_TypeUser = profileUser.name_Profile) objetoUser.save() return HttpResponseRedirect("/biosh/login") else: formulario = UserCreateForm() context ={ 'formulario':formulario, } return render(request, 'altaUser.html',context )
def add_user(request): if request.method == 'POST': formulario = UserCreateForm(request.POST) if formulario.is_valid: formulario.save() userNuevo = User.objects.get(username=request.POST['username']) profileUser = Profile.objects.get(id='3') objetoUser = Userprofile.objects.create( user_id=userNuevo.id, name_TypeUser=profileUser.name_Profile) objetoUser.save() return HttpResponseRedirect("/biosh/login") else: formulario = UserCreateForm() context = { 'formulario': formulario, } return render(request, 'altaUser.html', context)
def new_user ( request ): if request.POST: if request.method == 'POST': formulario = UserCreateForm(request.POST) typeUser = NewUserForm(request.POST) if formulario.is_valid: formulario.save() userNuevo = User.objects.get(username=request.POST['username']) profileUser = Profile.objects.get(id=request.POST['profile']) objetoUser = Userprofile.objects.create(user_id=userNuevo.id,name_TypeUser = profileUser.name_Profile) objetoUser.save() return HttpResponseRedirect('/biosh/configuracion') else: formulario = UserCreateForm() typeUser = NewUserForm() context ={ 'formulario':formulario, 'typeUser': typeUser, 'profile':request.user.get_profile(), } return render(request, 'newUser.html',context )
def new_user(request): if request.POST: if request.method == 'POST': formulario = UserCreateForm(request.POST) typeUser = NewUserForm(request.POST) if formulario.is_valid: formulario.save() userNuevo = User.objects.get(username=request.POST['username']) profileUser = Profile.objects.get(id=request.POST['profile']) objetoUser = Userprofile.objects.create( user_id=userNuevo.id, name_TypeUser=profileUser.name_Profile) objetoUser.save() return HttpResponseRedirect('/biosh/configuracion') else: formulario = UserCreateForm() typeUser = NewUserForm() context = { 'formulario': formulario, 'typeUser': typeUser, 'profile': request.user.get_profile(), } return render(request, 'newUser.html', context)