@@ -94,7 +94,7 @@ def __init__(self, model, app=None):
94
94
95
95
last_run_at = model .last_run_at
96
96
97
- if settings . DJANGO_CELERY_BEAT_TZ_AWARE :
97
+ if getattr ( settings , ' DJANGO_CELERY_BEAT_TZ_AWARE' , True ) :
98
98
last_run_at = make_aware (last_run_at )
99
99
100
100
self .last_run_at = last_run_at
@@ -133,7 +133,7 @@ def _default_now(self):
133
133
# The PyTZ datetime must be localised for the Django-Celery-Beat
134
134
# scheduler to work. Keep in mind that timezone arithmatic
135
135
# with a localized timezone may be inaccurate.
136
- if settings . DJANGO_CELERY_BEAT_TZ_AWARE :
136
+ if getattr ( settings , ' DJANGO_CELERY_BEAT_TZ_AWARE' , True ) :
137
137
now = now .tzinfo .localize (now .replace (tzinfo = None ))
138
138
return now
139
139
@@ -151,7 +151,7 @@ def save(self):
151
151
for field in self .save_fields :
152
152
setattr (obj , field , getattr (self .model , field ))
153
153
154
- if not settings . DJANGO_CELERY_BEAT_TZ_AWARE :
154
+ if not getattr ( settings , ' DJANGO_CELERY_BEAT_TZ_AWARE' , True ) :
155
155
obj .last_run_at = datetime .datetime .now ()
156
156
157
157
obj .save ()
0 commit comments