Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
django-timezone-utils
Advanced tools
.. image:: https://img.shields.io/pypi/v/django-timezone-utils.svg?maxAge=2592000 :target: https://pypi.python.org/pypi/django-timezone-utils/ :alt: Latest Version
.. image:: https://travis-ci.org/michaeljohnbarr/django-timezone-utils.png?branch=master :target: https://travis-ci.org/michaeljohnbarr/django-timezone-utils :alt: Test Status
.. image:: https://coveralls.io/repos/michaeljohnbarr/django-timezone-utils/badge.svg :target: https://coveralls.io/r/michaeljohnbarr/django-timezone-utils :alt: Coverage Status
.. image:: https://landscape.io/github/michaeljohnbarr/django-timezone-utils/master/landscape.png :target: https://landscape.io/github/michaeljohnbarr/django-timezone-utils :alt: Code Health
.. image:: https://img.shields.io/pypi/pyversions/django-timezone-utils.svg?maxAge=2592000 :target: https://pypi.python.org/pypi/django-timezone-utils/ :alt: Supported Python versions
.. image:: https://img.shields.io/pypi/l/django-timezone-utils.svg?maxAge=2592000 :target: https://pypi.python.org/pypi/django-timezone-utils/ :alt: License
.. image:: https://img.shields.io/pypi/status/django-timezone-utils.svg?maxAge=2592000 :target: https://pypi.python.org/pypi/django-timezone-utils/ :alt: Development Status
django-timezone-utils adds automatic time zone conversions and support utilities to Django.
Suggestions, constructive criticism, and feedback are certainly welcomed and appreciated.
Documentation for django-timezone-utils is available at Read the Docs <https://django-timezone-utils.readthedocs.org/>
_.
On multiple occasions, I have had the need to store time zone information to the one model, then base another model's datetime on that time zone. If you have ever had to deal with this, you will know how complicated this can be.
I created these fields to ease the process of manipulating times based on
another field's or models timezone choice. Instead of having to remember to use
Model.clean
, we can now create the models with the validation built
into the model field.
.. code-block:: python
from datetime import datetime
from timezone_utils.fields import LinkedTZDateTimeField, TimeZoneField
from timezone_utils.choices import PRETTY_ALL_TIMEZONES_CHOICES
class Location(models.Model):
# ...
timezone = TimeZoneField(choices=PRETTY_ALL_TIMEZONES_CHOICES)
def get_location_timezone(obj):
"""Returns the Location.timezone field from above"""
return obj.location.timezone
class LocationReport(models.Model):
# ...
location = models.ForeignKey('app_label.Location', related_name='reports')
# Populates from the Location.timezone
timestamp = LinkedTZDateTimeField(populate_from=get_location_timezone)
class LocationPeriod(models.Model):
# ...
location = models.ForeignKey('app_label.Location', related_name='periods')
# Sets the time to 12:00am in the location.timezone
start = LinkedTZDateTimeField(
populate_from=get_location_timezone,
time_override=datetime.min.time()
)
# Sets the time to 11:59:59.99999pm in the location.timezone
end = LinkedTZDateTimeField(
populate_from=get_location_timezone,
time_override=datetime.max.time()
)
Michael Barr <http://github.com/michaeljohnbarr>
_Kosei Kitahara <https://github.com/Surgo>
_Alex Kamedov <https://github.com/alekam>
_Pi Delport <https://github.com/pjdelport>
_time_override
caused invalid date due to not converting to the correct timezone first. Refactored conversion code. Added testing support for Django 1.8. Removed Django from setup requirements - the onus of having a supported version of Django is on the developer.time_override
caused invalid date due to not converting to the correct timezone first. Added choices GROUPED_ALL_TIMEZONES_CHOICES
and GROUPED_COMMON_TIMEZONES_CHOICES
to the documentation.GROUPED_ALL_TIMEZONES_CHOICES
and GROUPED_COMMON_TIMEZONES_CHOICES
.FAQs
Time Zone Utilities for Django Models
We found that django-timezone-utils demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.