def registration_view(request): redirect_to = "/" if request.method == 'POST': form = RegistrationForm(request.POST) email = request.POST.get("email") username = request.POST.get("username") password = request.POST.get("password") first_name = request.POST.get("first_name") last_name = request.POST.get("last_name") email = request.POST.get("email") if password == request.POST.get("repeat_password") and form.is_valid(): acc = UserAccount() user = User.objects.create_user(username=username, password=password, first_name=first_name, last_name=last_name, email=email) acc.user = user acc.phone_number = request.POST.get("phone_number") acc.save() return HttpResponseRedirect(redirect_to) form = RegistrationForm() context = {'form': form} return render(request, "registration.html", context)