2👍
Use form.cleaned_data.get('username')
instead of form.Cleaned_data
Edit
Use FormView
from django.views.generic.edit import FormView
class UserFormView(FormView):
form_class = UserForm
template_name = 'Home/index.html'
def form_valid(self, form):
user = form.save(commit=False)
username = form.cleaned_data.get('username')
...
get_form_class
returns the class of the form i.e UserForm
. You need is a object of that class. The class does not have any attribute cleaned_data
.
Source:stackexchange.com