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})