diff --git a/CHANGELOG.md b/CHANGELOG.md index 25cce55..ffc4a87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.1.2] + +### Fixed + +- Fixes compatibility between django 3.2 and 4.2 for next planned execution in admin + +## [1.1.1] + +### Fixed + +- Use custom css to fix external depenceny upload restriction + ## [1.1.0] ### Added @@ -16,6 +28,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Initial setup. -[Unreleased]: https://github.com/anexia/django-future-tasks/compare/1.0.0...HEAD +[Unreleased]: https://github.com/anexia/django-future-tasks/compare/1.1.2...HEAD +[1.1.2]: https://github.com/anexia/django-future-tasks/releases/tag/1.1.2 +[1.1.1]: https://github.com/anexia/django-future-tasks/releases/tag/1.1.1 [1.1.0]: https://github.com/anexia/django-future-tasks/releases/tag/1.1.0 [1.0.0]: https://github.com/anexia/django-future-tasks/releases/tag/1.0.0 diff --git a/django_future_tasks/models.py b/django_future_tasks/models.py index d5e4e08..c1ba4fa 100644 --- a/django_future_tasks/models.py +++ b/django_future_tasks/models.py @@ -1,20 +1,14 @@ import datetime -import uuid import croniter -from cron_descriptor import ( - CasingTypeEnum, - DescriptionTypeEnum, - ExpressionDescriptor, - Options, -) +from cron_descriptor import CasingTypeEnum, ExpressionDescriptor from cronfield.models import CronField from django.conf import settings from django.core.exceptions import ValidationError from django.db import models from django.db.models import JSONField, Q +from django.utils import timezone from django.utils.dateformat import format -from django.utils.timezone import utc from django.utils.translation import gettext_lazy as _ @@ -97,9 +91,9 @@ class PeriodicFutureTask(models.Model): ) def next_planned_execution(self): - now = datetime.datetime.now() - next_planned_execution = utc.localize( - croniter.croniter(self.cron_string, now).get_next(datetime.datetime) + now = timezone.now() + next_planned_execution = croniter.croniter(self.cron_string, now).get_next( + timezone.datetime ) if ( not self.is_active @@ -111,15 +105,13 @@ def next_planned_execution(self): or ( self.end_time is not None and self.end_time - < utc.localize( - croniter.croniter(self.cron_string, now).get_next(datetime.datetime) - ) + < croniter.croniter(self.cron_string, now).get_next(timezone.datetime) ) ): return None return format( - next_planned_execution, + timezone.template_localtime(next_planned_execution), settings.DATETIME_FORMAT, ) diff --git a/setup.py b/setup.py index 34eddc5..8eeca96 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setup( name="django-future-tasks", - version=os.getenv("PACKAGE_VERSION", "1.1.0").replace("refs/tags/", ""), + version=os.getenv("PACKAGE_VERSION", "1.1.2").replace("refs/tags/", ""), packages=find_packages(), include_package_data=True, install_requires=[ diff --git a/tests/core/settings.py b/tests/core/settings.py index ef6dc80..da5b0d6 100644 --- a/tests/core/settings.py +++ b/tests/core/settings.py @@ -91,7 +91,7 @@ LANGUAGE_CODE = "en-us" -TIME_ZONE = "UTC" +TIME_ZONE = "Europe/Vienna" USE_I18N = True