django’s User model has a last_login field, which is great if all the users were to log out each time they leave the site, but what if they don’t?
How can I track when a user who never logged out and his activity on the site?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to have the
last_activityfield in the user profile (or custom user model). This field will be updated on every request. To achieve this you need to have custom middleware:profiles/middleware.py:
Add this middleware in your setting file: