def add_User(request): form = UserCreateForm() if request.method == "POST": form = UserCreateForm(request.POST) if form.is_valid(): form.save() return redirect("home") return render_to_response("add_User.html", {"form": form}, RequestContext(request))
def add_User(request): form = UserCreateForm() if request.method == 'POST': form = UserCreateForm(request.POST) if form.is_valid(): form.save() return redirect('home') return render_to_response('add_User.html', { 'form': form, }, RequestContext(request))
def signup(request): if request.method == 'POST': user_form = UserCreateForm(request.POST) if user_form.is_valid(): username = user_form.clean_username() password = user_form.clean_password2() user_form.save() user = authenticate(username=username, password=password) login(request, user) return redirect("/") else: return render(request, 'main/signup.html', { 'form' : user_form }) return render(request, 'main/signup.html')
def registro(request): form = UserCreateForm if request.method == 'POST': form = UserCreateForm(request.POST) if form.is_valid(): user = form.save() UserProfile.objects.create(user=user) return redirect('login') return render_to_response('registro.html', { 'form': form, }, RequestContext(request))