I am working with a Django application, and my current goal is to track a user's session using cookies. I have a feeling that, as always, my understanding is a little embarrassing about how I do it.
To begin with, I would like to control how much time has passed since the user entered the system, so I can successfully withdraw them if they have not visited a new page in the "x" hours. I'm not sure what exactly is standard (for a social network).
Is this information on my server? Do cookies really have any relevance here? I used cookies before to store things like user timezone, but I'm struggling to figure out how I track the user.
All I currently have in terms of user end is the django.contrib.auth package.
The only thing I really know how to do in terms of “capturing” user information is done using operators such as if request.user.is_authenticated(): (etc.).
I understand this is a tricky question, so I will try to narrow it down:
How can I expand existing information about the current user to capture the "last activity" so that I can log him out if they have not used the site for a certain period of time? Do I need to define a custom model?
The next step after this is to create a different type of user, so it seems to me that I need to create custom models - in addition to expanding the regular user form to create a profile, etc.
Thank you for understanding,
I know that I can be confusing when I don't understand things.
Thank you for your time,
James
source share