
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
django-easy-timezones-redux
Advanced tools
Easy IP-based timezones for Django (>=1.11) based on MaxMind GeoIP, with IPv6 support.
Updated fork of django-easy-timezones
that uses the new version of MaxMind's GeoIP2 database.
Install django-easy-timezones-redux
pip install django-easy-timezones-redux
Add "easy-timezones" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = (
...
'easy_timezones',
)
Add EasyTimezoneMiddleware to your MIDDLEWARE
MIDDLEWARE = (
...
'easy_timezones.middleware.EasyTimezoneMiddleware',
)
Add a path to the MaxMind GeoLite2 cities databases in your settings file:
GEOIP2_DATABASE = '/path/to/your/geoip/database/GeoLite2-City.mmdb'
Enable localtime in your templates.
{% load tz %}
The UTC time is {{ object.date }}
{% localtime on %}
The local time is {{ object.date }}
{% endlocaltime %}
That's it!
You can also use signals to perform actions based on the timezone detection.
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()
FAQs
Easy timezones for Django (>=1.11) based on MaxMind GeoIP2.
We found that django-easy-timezones-redux demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.