def contact(request): if request.POST: form = RegistrationForm(request.POST) if form.is_valid(): form.save() return HttpResponse('<html>info submitted</html>') else: form = RegistrationForm() return render(request,'contact.html',{'form':form})
def register_user(request): if request.method == "POST": form = RegistrationForm(request.POST) if form.is_valid(): form.save() args = {'user': request.user} return redirect('account:home') # return render(request, 'home.html', args) else: form = RegistrationForm() args = {'form': form} return render(request, 'account/reg_form.html', args)
def register(request): args = {} args.update(csrf(request)) args['form'] = RegistrationForm() if request.POST: newuser_form = RegistrationForm(request.POST) if newuser_form.is_valid(): newuser_form.save() newuser = auth.authenticate( username=newuser_form.cleaned_data['username'], password=newuser_form.cleaned_data['password2']) auth.login(request, newuser) return redirect('/') else: args['form'] = newuser_form return render_to_response('polls/reg_form.html', args)
def register(request): form = RegistrationForm(request.POST or None, prefix="rf") form2 = ProfileForm(request.POST or None, prefix="up") if form.is_valid() and form2.is_valid(): if form.save(): u = authenticate(username=form.cleaned_data["username"], password=form.cleaned_data["password1"]) user_profile = form2.save(commit=False) user_profile.user = u user_profile.save() login(request, u) return HttpResponseRedirect(reverse("poll_index")) return render(request, "registration/register.html", {"form": form, "up_form": form2})
def register(request): form = RegistrationForm(request.POST or None, prefix="rf") form2 = ProfileForm(request.POST or None, prefix="up") if form.is_valid() and form2.is_valid(): if form.save(): u = authenticate(username=form.cleaned_data['username'], password=form.cleaned_data['password1']) user_profile = form2.save(commit=False) user_profile.user = u user_profile.save() login(request, u) return HttpResponseRedirect(reverse("poll_index")) return render(request, "registration/register.html", { 'form': form, 'up_form': form2 })
def account_view(request): form = RegistrationForm(request.POST or None) user_id = request.se if form.is_valid(): new_user = form.save(commit=False) username = form.cleaned_data['username'] password = form.cleaned_data['password'] email = form.cleaned_data['email'] first_name = form.cleaned_data['first_name'] last_name = form.cleaned_data['last_name'] new_user.username = username new_user.set_password(password) new_user.first_name = first_name new_user.last_name = last_name new_user.email = email new_user.save() context = {'form': form} return render(request, 'registration.html', context)
def registration_view(request): form = RegistrationForm(request.POST or None) if form.is_valid(): new_user = form.save(commit=False) username = form.cleaned_data['username'] password = form.cleaned_data['password'] email = form.cleaned_data['email'] first_name = form.cleaned_data['first_name'] last_name = form.cleaned_data['last_name'] new_user.username = username new_user.set_password(password) new_user.first_name = first_name new_user.last_name = last_name new_user.email = email new_user.save() login_user = authenticate(username=username, password=password) if login_user: login(request, login_user) return HttpResponseRedirect(reverse('index')) context = {'form': form} return render(request, 'registration.html', context)