Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix breakage caused by change in django-timezone-field #378

Merged
merged 2 commits into from
Dec 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion django_celery_beat/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ def crontab_schedule_celery_timezone():
except AttributeError:
return 'UTC'
return CELERY_TIMEZONE if CELERY_TIMEZONE in [
choice[0].zone for choice in timezone_field.TimeZoneField.CHOICES
choice[0].zone for choice in timezone_field.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this also need change in model migrations?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@auvipy I don't think any other changes will be needed, the tuples outputted by TimeZoneField.CHOICES and default_choices are the same and so the data should be the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(venv) ~/D/django-celery-beat ❯❯❯ python3.9 manage.py makemigrations                                                                         master
No changes detected

TimeZoneField.default_choices
] else 'UTC'


Expand Down
2 changes: 1 addition & 1 deletion requirements/default.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
celery>=4.4,<6.0
django-timezone-field>=4.0,<5.0
django-timezone-field>=4.1.0,<5.0
python-crontab>=2.3.4
3 changes: 2 additions & 1 deletion t/unit/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def test_models_match_migrations(self):


class CrontabScheduleTestCase(TestCase):
FIRST_VALID_TIMEZONE = timezone_field.TimeZoneField.CHOICES[0][0].zone
FIRST_VALID_TIMEZONE = timezone_field.\
TimeZoneField.default_choices[0][0].zone

def test_default_timezone_without_settings_config(self):
assert crontab_schedule_celery_timezone() == "UTC"
Expand Down