def signupview(request): html = "signup.html" if request.method == "POST": form = SignUpForm(request.POST) if form.is_valid: form.save() return HttpResponseRedirect(reverse('login')) else: form = SignUpForm() context = {'form': form} return render(request, html, context)
def signup(request): if request.method == 'POST': form = SignUpForm(request.POST) print(form.field_order) if form.is_valid(): form.save() username = form.cleaned_data.get('username') raw_password = form.cleaned_data.get('password1') user = authenticate(username=username, password=raw_password) login(request, user) return redirect('home') else: return render(request, 'auth/signup.html', {'form': form}) else: form = SignUpForm() print(form.as_table()) return render(request, 'auth/signup.html', {'form': form})