python - Hacking Django Admin, hooks for login/logout - Stack Overflow: "
3
down vote
accepted
I was also looking for an answer to this and ended up going another way. You can use your own views for login and logout, which perform some action and then call the auth views. For login:
def login(request, *args, **kwargs):
from django.contrib.auth.forms import AuthenticationForm
if request.method == 'POST':
form = AuthenticationForm(data=request.POST)
if form.is_valid():
# login successful
do_something()
from django.contrib.auth.views import login as authlogin
return authlogin(request, *args, **kwargs)
And for logout:"
'via Blog this'