A Django package to show online/offline status and last seen time.
Project description
Django User Status
A simple Django package to track and display a user's online/offline status and last seen time using Django's caching framework.
Installation
-
Install the package:
pip install django-user-status -
Add the middleware to your
settings.py:MIDDLEWARE = [ # ... other middleware 'django_user_status.middleware.UserStatusMiddleware', ]
Load the template tags in your templates:
{% load user_status_tags %}
Configuration (Optional) You can customize the package's behavior by adding the following settings to your settings.py file.
- USER_STATUS_CACHE_DURATION: The time in seconds that a user is considered "online" after their last request. Defaults to 300 (5 minutes).
- USER_STATUS_CACHE_KEY_PREFIX: The prefix for the cache key. Useful to avoid key collisions. Defaults to 'last_seen'. Example settings.py:
Set the user to be "online" for 10 minutes
USER_STATUS_CACHE_DURATION = 600
Use a different cache key prefix
USER_STATUS_CACHE_KEY_PREFIX = 'user_activity'
Usage In your templates: To show a user's status:
{% get_user_status user %}
To show the last seen time:
{% get_last_seen user %}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_user_status-0.1.0.tar.gz.
File metadata
- Download URL: django_user_status-0.1.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e087e2c62515bec6891778353d50e3ae5e5cddcf47379f47571a71b551a6b4fa
|
|
| MD5 |
ce69867d3ba94f6b30410d30b6d162b0
|
|
| BLAKE2b-256 |
f6164c3947a45d0b115299abcab929dcb849d3d4825206311ec7bf1d694677bc
|
File details
Details for the file django_user_status-0.1.0-py3-none-any.whl.
File metadata
- Download URL: django_user_status-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ffd124bccfdb2d6ead6c25912ae257326ec83efe599366691e182f86f32143be
|
|
| MD5 |
082bb3638711976d75040b0761571bb2
|
|
| BLAKE2b-256 |
50c9d260c8d54e819d0a10b7d3a1d18e63188d2ad72ada56f7e44c3cd2f45fcf
|