Hi,
I am using django auth module.Now,when user logs in I want to record users ipaddress in the admin_log table.How can I do this?
thanks
Hi,
I am using django auth module.Now,when user logs in I want to record users ipaddress in the admin_log table.How can I do this?
thanks
Create a middleware, that will be called after AuthenticationMiddleware
is called (it must be spcified after the latter in settings.py
). In this middleware retrieve ip address from HttpRequest.META
attribute (it would be probably request.META['REMOTE_ADDR']
) and add this information to the admin_log
table. But is admin_log
exactly the place where you would like to store this information?