Last active
August 6, 2019 01:31
-
-
Save wmantly/f2a2e9c43f05d0a540483b0267474895 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Login(View): | |
template = 'users/login.html' | |
form = AuthenticationForm | |
def get(self, request): | |
context = { | |
'loginForm': self.form() | |
} | |
return render(request, self.template, context) | |
def post(self, request): | |
form = self.form(request, request.POST) | |
if form.is_valid(): | |
login(request, form.get_user()) | |
return redirect('users:profile') | |
else: | |
context = { | |
'loginForm': form | |
} | |
return render(request, self.template, context) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment