You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
644 B

from django.shortcuts import render
from .forms import *
def userinfo_form(request):
if request.method == "GET":
myform = UserInfoForm()
return render(request, "form_demo/userinfo.html", {'form_obj': myform})
else:
f = UserInfoForm(request.POST)
if f.is_valid():
print(f.clean())
print(f.cleaned_data['username'])
print(f.data)
else:
errors = f.errors
print(errors)
return render(request, "form_demo/userinfo.html", {'form_obj': f, 'errors': errors})
return render(request, "form_demo/userinfo.html", {'form_obj': f})