Django Sage Timezone Management
Django Sage Timezone Management is a Django package that allows administrators to easily select and apply a timezone for their session directly from the Django Admin interface. Once set, the timezone is automatically applied to all datetime displays during the session.
Features
- Adds a "Select Timezone" option in the Django Admin navigation bar.
- Automatically applies the selected timezone to the user's session using middleware.
- Supports all timezones available through
pytz. - Simple integration with existing Django projects.
Installation
Using pip with virtualenv
-
Create a Virtual Environment:
python -m venv .venv
-
Activate the Virtual Environment:
-
On Windows:
.venv\Scripts\activate
-
On macOS/Linux:
source .venv/bin/activate
-
-
Install
django-sage-timezone:pip install django-sage-timezone
Using poetry
-
Initialize Poetry (if not already initialized):
poetry init -
Install
django-sage-timezone:poetry add django-sage-timezone
-
Apply Migrations:
After installation, ensure to run the following commands to apply necessary migrations:
python manage.py makemigrations python manage.py migrate
Configuration
Django Settings
Add django-sage-timezone to your INSTALLED_APPS in the Django settings:
INSTALLED_APPS = [
...
"sage_timezone",
"django.contrib.admin"
]
Also, add the TimezoneMiddleware to your middleware settings:
MIDDLEWARE = [
"django.contrib.sessions.middleware.SessionMiddleware",
"sage_timezone.middleware.TimezoneMiddleware",
...
]
Important Note:
The sage_timezone.middleware.timezone.TimezoneMiddleware must be placed after the django.contrib.sessions.middleware.SessionMiddleware in your MIDDLEWARE setting. This order is crucial to ensure that the session data is available when the timezone is set.
Note:
You can set a custom session name in your Django settings using the TIME_ZONE_SESSION_NAME setting. For example:
TIME_ZONE_SESSION_NAME = 'your_custom_session_name'
Usage
Once configured, the Django Admin will include a "Select Timezone" option in the navigation bar. Administrators can choose their preferred timezone, which will be applied to their session.
Metadata
Release files for django-sage-timezone 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_sage_timezone-0.1.3.tar.gz | 10.4 kB | Without provenance | Details for django_sage_timezone-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_sage_timezone-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for django_sage_timezone-0.1.3-py3-none-any.whl |
Total release size: 24.2 kB
Release files / django_sage_timezone-0.1.3.tar.gz
| Download URL | django_sage_timezone-0.1.3.tar.gz |
|---|---|
| Size | 10.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7aa1a3ec706fac3f559b9feeab8d282678d6e424b1ced743734c0c921e08647b
|
|
BLAKE2b-256 checksum How to use checksums |
1d8f027996ffa6044e58c38c1b469f58a6ced1372ba16248e207f0dee5e3c56e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.4 Windows/11
|
Release files / django_sage_timezone-0.1.3-py3-none-any.whl
| Download URL | django_sage_timezone-0.1.3-py3-none-any.whl |
|---|---|
| Size | 13.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b8d7d246eb496a673e315617e82300b75decd83b9b63019cc313e73e7682188c
|
|
BLAKE2b-256 checksum How to use checksums |
c2140a573848395acc38ceddf76b876aeb8c151de722d9ccde521ccbea0427ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.4 Windows/11
|
Security for django-sage-timezone 0.1.3
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.