[Answer]-How to use User class in Django

1👍

The reason is that you are reassignning the value of the form after validate it. When you mas is_valid(), if it is, you will be able to access to cleaned data, but not before. Try to change your just commenting the recond uf assignation:

def Userlogin(request):
    uf = UserForm(request.POST)
    if request.method == "POST":
        if uf.is_valid():
            #uf = UserForm(request.POST)
            username = uf.cleaned_data['username']
            password = uf.cleaned_data['password']

Leave a comment