Keep track of when a user has been last seen
Homepage Repository PyPI Python
pip install django-last-seen==0.2
Keep trak of when a user has been last seen on a website. The last seen time is kept on the database
The app is ready for django 1.5, it uses the AUTH_USER_MODEL setting to get the user model,
pip install django-last-seen"
or add "last_seen"
directory to your Python path."last_seen"
to the INSTALLED_APPS
tuple found in your settings
file.manage.py syncdb
to create the new tablesTo get when a user has been last seen:
from last_seen.model import LastSeen seen = LastSeen.object.when(user=user)
To save a last seen user without the middleware:
from last_seen.model import LastSeen # save with a special module LastSeen.object.when(user=user, module='forum')
The provided middleware keeps track of when an authenticated user has been last seen on the site,
If you want to keep track of a user last seen on a part of a site, you can use a special module name and use:
from last_seen.model import LastSeen # save with a special module LastSeen.object.when(user=user, module='forum')
Then to get the data:
from last_seen.model import LastSeen # user last seen on any part of the site seen = LastSeen.object.when(user=user) # user last seen on a module seen = LastSeen.object.when(user=user, module='forum')
default
.