{"id":17829465,"url":"https://github.com/miserlou/django-easy-timezones","last_synced_at":"2025-04-05T09:07:58.327Z","repository":{"id":9558492,"uuid":"11467940","full_name":"Miserlou/django-easy-timezones","owner":"Miserlou","description":"Easy timezones for Django based on GeoIP","archived":false,"fork":false,"pushed_at":"2023-07-20T22:44:06.000Z","size":23475,"stargazers_count":203,"open_issues_count":19,"forks_count":44,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-29T08:11:15.564Z","etag":null,"topics":["automatic","django","easy","easy-timezones","easy-to-use","geoip","python","timezone"],"latest_commit_sha":null,"homepage":"http://gun.io/blog/django-easy-timezones/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"programthink/zhao","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Miserlou.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2013-07-17T05:27:45.000Z","updated_at":"2025-03-26T08:29:01.000Z","dependencies_parsed_at":"2024-01-18T09:04:50.426Z","dependency_job_id":"5fac2243-8ce3-4577-b1a8-75cd2201fa87","html_url":"https://github.com/Miserlou/django-easy-timezones","commit_stats":{"total_commits":56,"total_committers":7,"mean_commits":8.0,"dds":0.375,"last_synced_commit":"a25c6312a7ecb3ebfac7b2c458b1c5be5d45a239"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Miserlou%2Fdjango-easy-timezones","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Miserlou%2Fdjango-easy-timezones/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Miserlou%2Fdjango-easy-timezones/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Miserlou%2Fdjango-easy-timezones/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Miserlou","download_url":"https://codeload.github.com/Miserlou/django-easy-timezones/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247312078,"owners_count":20918344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automatic","django","easy","easy-timezones","easy-to-use","geoip","python","timezone"],"created_at":"2024-10-27T19:15:48.889Z","updated_at":"2025-04-05T09:07:58.273Z","avatar_url":"https://github.com/Miserlou.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Timezones. Yuck.](http://i.imgur.com/Qc2W47H.gif)\n\ndjango-easy-timezones [![Build Status](https://travis-ci.org/Miserlou/django-easy-timezones.svg)](https://travis-ci.org/Miserlou/django-easy-timezones)\n=====================\n\nEasy IP-based timezones for Django (\u003e=1.7) based on MaxMind GeoIP, with IPv6 support.\n\nQuick start\n-----------\n\n1. Install django-easy-timezones\n\n    ```python\n    pip install django-easy-timezones\n    ```\n\n1. Add \"easy-timezones\" to your INSTALLED_APPS setting like this:\n\n    ```python\n    INSTALLED_APPS = (\n      ...\n      'easy_timezones',\n    )\n    ```\n\n1. Add EasyTimezoneMiddleware to your MIDDLEWARE_CLASSES \n\n    ```python\n    MIDDLEWARE_CLASSES = (\n      ...\n      'easy_timezones.middleware.EasyTimezoneMiddleware',\n    )\n    ```\n\n1. (Optionally) Add a path to the [MaxMind GeoIP cities databases](http://dev.maxmind.com/geoip/legacy/geolite/) ([direct\nlink](http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz) because I'm nice) in your settings file:\n\n    ```python\n    GEOIP_DATABASE = '/path/to/your/geoip/database/GeoLiteCity.dat'\n    GEOIPV6_DATABASE = '/path/to/your/geoip/database/GeoLiteCityv6.dat'\n    ```\n\n1. Enable localtime in your templates.\n\n    ```python\n    {% load tz %}\n        The UTC time is {{ object.date }}\n    {% localtime on %}\n        The local time is {{ object.date }}\n    {% endlocaltime %}\n    ```\n1. Twist one up, cause you're done, homie!\n\n## Signals\n\nYou can also use signals to perform actions based on the timezone detection.\n\n1. 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:\n\n\t```python\n\tfrom easy_timezones.signals import detected_timezone\t\n\n\t@receiver(detected_timezone, sender=MyUserModel)\n\tdef process_timezone(sender, instance, timezone, **kwargs):\n    \tif instance.timezone != timezone:\n        \tinstance.timezone = timezone\n        \tinstance.save()\n\t```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiserlou%2Fdjango-easy-timezones","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiserlou%2Fdjango-easy-timezones","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiserlou%2Fdjango-easy-timezones/lists"}