Easily set a localized timezone for users
Project description
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).
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.
Project details
Release history Release notifications | RSS feed
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
Hashes for awesome-django-timezones-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5946b9e25b7523c988f015c1dcbc53ddde4734f85d25a292f33eac0c466b4a6a |
|
MD5 | ce9b8b1e4dee018be90d689af6e6ff9d |
|
BLAKE2b-256 | b53fa4dfa578b1a9c07e59433db06aefa4e54acefaef3ce139e2e36df7e59c3a |
Hashes for awesome_django_timezones-0.2.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3120a9a97b32bae8a763eec3f20782ef9aebf977c91d6c0fb049b340f51fa97 |
|
MD5 | cc4f7e23373e3ffbf0c50bb189b25c62 |
|
BLAKE2b-256 | 79e5d771e26c940d05a352e1dd9a9a6052f6dd53914fb6dabadfec442289aa03 |