2 files were added to this release more than 14 days after its initial publication. Inspect the release files before installing.
django-online-users
Tracks the time of each user’s last action
Using middleware, django-online-users will keep track of each user and the timestamp of their last action in the database.
Admins can see this data in the admin portal, and the database can be queried using timedeltas.
This is meant for smaller applications as each HTTP request will result in a database entry update.
Requirements
Python: 2.7, 3.3, 3.4, 3.5, 3.6
Django: 1.10+
Setup
Add “online_users” to your INSTALLED_APPS
INSTALLED_APPS = [
...
'online_users',
]
Add the OnlineNowMiddleware to your MIDDLEWARE_CLASSES after the SessionMiddleware
MIDDLEWARE_CLASSES = (
...
'online_users.middleware.OnlineNowMiddleware',
)
Run python manage.py migrate to create the tables in the database.
Use
The time of the last action for each user can be seen in the admin portal at http://127.0.0.1:8000/admin/online_users/onlineuser/
To retrieve the current number of users online in the last 15 minutes
from datetime import timedelta
...
user_activity_objects = OnlineUserActivity.get_user_activities()
number_of_active_users = user_activity_objects.count()
A timedelta can also be specified to the get_user_activities() with to find activity
from datetime import timedelta
...
user_activity_objects = OnlineUserActivity.get_user_activities(timedelta(minutes=60)
users = (user for user in user_activity_objects)
API
OnlineUserActivity holds two values: user, the user in question, and last_activity, a timestamp stored as a DateTimeField.
OnlineUserActivity.get_user_activities() will return OnlineUserActivity objects for the last 15 minutes by default. Developers can also pass in a time delta of a different length of time for the query. The response is a QuerySet containing the active users during that time period, and the items are sorted in descending chronological order.
Metadata
Release files for django-online-users 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Files added late
2 files were uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release files before installing.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-online-users-0.1.tar.gz | 5.4 kB | Without provenance | Details for django-online-users-0.1.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_online_users-0.3-py3-none-any.whl | Python 3 | none | any | Details for django_online_users-0.3-py3-none-any.whl |
| django_online_users-0.3-py2-none-any.whl | Python 2 | none | any | Details for django_online_users-0.3-py2-none-any.whl |
| django_online_users-0.1-py3-none-any.whl | Python 3 | none | any | Details for django_online_users-0.1-py3-none-any.whl |
Total release size: 32.2 kB
Release files / django-online-users-0.1.tar.gz
| Download URL | django-online-users-0.1.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6d9a82cd60d97eeb20ec2c12712c4ea16f0fcbe322217d5cab783c64c6ede147
|
|
BLAKE2b-256 checksum How to use checksums |
eae3017e5e08e0619127b1f49fc9993c253f0ef7d759996c67f0472036417fa4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / django_online_users-0.3-py3-none-any.whl
File added late
This file was uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release file before installing.
| Download URL | django_online_users-0.3-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d235040c1f2b76739b742c7a70c78f602c1faa6d084ea6b22782ef84b9289793
|
|
BLAKE2b-256 checksum How to use checksums |
8cf383ad96a0b6b840d282abe38dcd89e8338072ed1f3ebc7b28f304cc18baa5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / django_online_users-0.3-py2-none-any.whl
File added late
This file was uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release file before installing.
| Download URL | django_online_users-0.3-py2-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
04906a4a580bb0574fb34d73afd6f2938816ff8fef62431399ee4561d37df76c
|
|
BLAKE2b-256 checksum How to use checksums |
4cca59f65d32be134b2eea6ea89cbdba605cbbd6be005a5bda53a83820f601a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / django_online_users-0.1-py3-none-any.whl
| Download URL | django_online_users-0.1-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
26f6ecadb16057a29898e1219b86bddaec027c9fe4c2abcc037267034ea7e5ee
|
|
BLAKE2b-256 checksum How to use checksums |
fead9cf0c2fe3acb0d9d782b01bc136d28a117d606d0806d5b60caa2cff5c860
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-online-users 0.1
Upload timing
Release files added late
2 files were uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.