def register(request): if request.method == "POST": form = PersonForm(request.POST) if form.is_valid(): firstname = form.cleaned_data["first_name"] lastname = form.cleaned_data["last_name"] uni = form.cleaned_data["university"] email = form.cleaned_data["email"] p = Person(first_name=firstname, last_name=lastname, university=uni, email=email) p.save() else: form = PersonForm() return render(request, "reviews/register.html", {"form": form}) """
def register(request): if request.method == 'POST': form = PersonForm(request.POST) if form.is_valid(): username = form.cleaned_data['username'] #lastname = form.cleaned_data['last_name'] #email = form.cleaned_data['email'] password = form.cleaned_data['password'] university = form.cleaned_data['university'] email = form.cleaned_data['email'] user = User.objects.create_user(username,password) user.save() p = Person(first_name = firstname, last_name = lastname, university = uni,email = email) p.save() else: form = PersonForm() return render(request,'reviews/register.html',{ 'form': form, })