aperezalbela
Joined 12 years ago
Karma
15
Submissions
13
Member since
Jul 17
Joined 12 years ago
username = forms.CharField(max_length=150) password = forms.CharField(widget=forms.PasswordInput)
and then a view to instantiate form with request.POST (if request.POST) like:
form = LoginForm(request.POST)
and then if form.is_valid() you can clean data using
username = form.cleaned_data['username']
and the same for password.
Then:
user = authenticate(request, username=username, password=password)
and then check if user is not None then login(request, user)
Note that login and authenticate come from django.contrib.auth import authenticate, login
Hope that helps.
The reasons, well, could be added as comments here in the thread. Though, as you may imagine, it's mostly because of my eyes when I visit you guys without daylight.