Hello Members,I am new to Django, and trying to create a mock Django registration page. I am using default Django "User" model to do that, and I am not customizing anything. Its a very simple form with 3 fields as follows:'username','password','email'. Below are my python and html code details:
views.py--------def SignUpFormView(request):user_form = 'SignUpForm'
template_name = 'test.html'if request.method == 'POST':form = user_form(request.POST)if form.is_valid():form.save()#username = form.cleaned_data.get('username')#password = form.cleaned_data.get('password')#email = form.cleaned_data.get('email')#user.save()return render(request, template_name, {'form':form})else:SignUpForm()return render(request, 'user_info/about.html')
My issue is, when trying to launch the "register" page, its not going inside "if" condition in views.py, rather its going directly to "else" condition.I am tried many things under my reach, but couldn't resolve the issue, and stuck for 2 weeks now.Any help would be appreciated.
primary :: 91-907 529 6235
Hello Members,I am new to Django, and trying to create a mock Django registration page. I am using default Django "User" model to do that, and I am not customizing anything. Its a very simple form with 3 fields as follows:'username','password','email'. Below are my python and html code details:
views.py--------def SignUpFormView(request):user_form = 'SignUpForm'
template_name = 'test.html'if request.method == 'POST':form = user_form(request.POST)if form.is_valid():form.save()#username = form.cleaned_data.get('usernam e')
#password = form.cleaned_data.get('passwor d')
#email = form.cleaned_data.get('email')#user.save()return render(request, template_name, {'form':form})else:SignUpForm()return render(request, 'user_info/about.html')
My issue is, when trying to launch the "register" page, its not going inside "if" condition in views.py, rather its going directly to "else" condition.I am tried many things under my reach, but couldn't resolve the issue, and stuck for 2 weeks now.Any help would be appreciated.
primary :: 91-907 529 6235
views.py--------def SignUpFormView(request):user_form = 'SignUpForm'template_name = 'test.html'
if request.method == 'POST':form = user_form(request.POST)
if form.is_valid():form.save()#username = form.cleaned_data.get('username')#password = form.cleaned_data.get('password')#email = form.cleaned_data.get('email')#user.save()
return render(request, template_name, {'form':form})
else:SignUpForm()
return render(request, 'user_info/about.html')
test.html---------