Easily set a localized timezone for users
Documentation
The full documentation is at https://awesome-django-timezones.readthedocs.io.
Quickstart
Install Awesome Django Timezones:
pip install awesome-django-timezones
Add it to your INSTALLED_APPS:
INSTALLED_APPS = (
...
'awesome_django_timezones',
...
)
Add DjangoTimezonesMiddleware to your MIDDLEWARE_CLASSES:
MIDDLEWARE_CLASSES = (
...
'awesome_django_timezones.middleware.TimezonesMiddleware',
...
)
Add js/awesome_django_timezones.js to your base template
<script src="{% static 'awesome_django_timezones/js/awesome_django_timezones.js' %}"></script>
(Optional) If you need Django to be timezone aware on the Admin page, you will have to extend the Admin base.html in your_project/templates/admin/base.html
{% extends 'admin/base.html' %}
{% load static %}
{% block footer %}
{{ block.super }}
<script src="{% static 'js/awesome_django_timezones.js' %}"></script>
{% endblock %}
Features
Provides an accurate method of determining the an end user’s timezone and activating that timezone in Django.
Uses client side, JavaScript detection for the most accurate method of determining a timezone.
Uses the widely supported, native Intl JavaScript library to detect the client’s timezone. This library is not currently implemented for IE11.
Falls back to server side timezone detection via an IP API.
Fall back is provided for IE11 clients or clients with JavaScript disabled.
Relies on third-party IP API lookups by https://ipapi.co. Consider purchasing a plan if you need more than 30k IP lookups/month or if you need support (no affiliation).
Set a fallback timezone to always use in case a timezone can’t be found with AWESOME_TZ_DEFAULT_TZ in your settings.py. (Be sure to use the “TZ database name” column from https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
Running Tests
Does the code actually work?
source <YOURVIRTUALENV>/bin/activate (myenv) $ pip install -r requirements_test.txt (myenv) $ tox
Credits
Tools used in rendering this package:
History
0.1.0 (2019-02-04)
First release on PyPI.
Metadata
Release files for awesome-django-timezones 0.3.0
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 | |
|---|---|---|---|---|
| awesome-django-timezones-0.3.0.tar.gz | 7.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| awesome_django_timezones-0.3.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 13.9 kB
Release files / awesome-django-timezones-0.3.0.tar.gz
| Download URL | awesome-django-timezones-0.3.0.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d97cb781a193cf06214c617594c9c789e692304586306b8d5dbb55b16a79a754
|
|
BLAKE2b-256 checksum How to use checksums |
8f079eee2ae9da7c6444aea0f5b0001da32f8411c8e975a663cd9c6b33e2ef7c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.8
|
Release files / awesome_django_timezones-0.3.0-py2.py3-none-any.whl
| Download URL | awesome_django_timezones-0.3.0-py2.py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
22acf051e8287c1af743cdea227ceb5a132ed2d0caaf3fe5128e39ccd10b31a1
|
|
BLAKE2b-256 checksum How to use checksums |
9f0300292801afbc9361860ba579f47617ae425c358c7ad03b1afd067e94596b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.8
|
Security for awesome-django-timezones 0.3.0
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.