Skip to main content
Timezones. Yuck.

Timezones. Yuck.

django-easy-timezones Build Status

Easy IP-based timezones for Django (>=1.7) based on MaxMind GeoIP, with IPv6 support.

Quick start

  1. Install django-easy-timezones

    pip install django-easy-timezones
  2. Add “easy-timezones” to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = (
      ...
      'easy_timezones',
    )
  3. Add EasyTimezoneMiddleware to your MIDDLEWARE_CLASSES

    MIDDLEWARE_CLASSES = (
      ...
      'easy_timezones.middleware.EasyTimezoneMiddleware',
    )
  4. (Optionally) Add a path to the MaxMind GeoIP cities databases (direct link because I’m nice) in your settings file:

    GEOIP_DATABASE = '/path/to/your/geoip/database/GeoLiteCity.dat'
    GEOIPV6_DATABASE = '/path/to/your/geoip/database/GeoLiteCityv6.dat'
  5. Enable localtime in your templates.

    {% load tz %}
        The UTC time is {{ object.date }}
    {% localtime on %}
        The local time is {{ object.date }}
    {% endlocaltime %}
  6. Twist one up, cause you’re done, homie!

Signals

You can also use signals to perform actions based on the timezone detection.

  1. To hook into the Timezone detection event to, say, save it to the request’s user somewhere more permanent than a session, do something like this:

    from easy_timezones.signals import detected_timezone
    
    @receiver(detected_timezone, sender=MyUserModel)
    def process_timezone(sender, instance, timezone, **kwargs):
        if instance.timezone != timezone:
            instance.timezone = timezone
            instance.save()

Metadata

Release files for django-easy-timezones 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-easy-timezones 0.8.0
File Size Uploaded Provenance
django-easy-timezones-0.8.0.tar.gz 24.0 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-easy-timezones 0.8.0
File Interpreter ABI Platform
django_easy_timezones-0.8.0-py2-none-any.whl Python 2 none any Details

Total release size: 24.0 MB

Release files / django-easy-timezones-0.8.0.tar.gz

Download URL django-easy-timezones-0.8.0.tar.gz
Size 24.0 MB
Tags Source
SHA-256 checksum
How to use checksums
d28a5e60263de39eeef72240dac01090a11f7212d942dfbd3b4ba4be7b2bf77e
BLAKE2b-256 checksum
How to use checksums
3729a7704dfb1941af1c2886136153ab2bae4261a01917bdfae0d6af028161ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_easy_timezones-0.8.0-py2-none-any.whl

Download URL django_easy_timezones-0.8.0-py2-none-any.whl
Size 9.3 kB
Tags Python 2
SHA-256 checksum
How to use checksums
1c90f8a9731bf0762b6c7d239beb5b9434f45e8c9bbdc3586faa69851d00c434
BLAKE2b-256 checksum
How to use checksums
c7a19aefa75fa468a986b7151d754d9f276eb43f088573a6a55962487cf565dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-easy-timezones 0.8.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page