Pregunta

I am using Django's default authentication system to run my website. So whenever a user logs in in urls.py I have -

(r'^login/$', 'django.contrib.auth.views.login'),

I guess django uses django.contrib.auth.login & django.contrib.auth.authenticate to login.

Now as part of some requirement I am needed to run some function calls just after a user logs in. How do i do that ?

¿Fue útil?

Solución

Just include a signal function. Whenever a user logs in, django fires a signal and your function will be called.

Refer the documentation on auth signals.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top