@@ -94,7 +94,7 @@ def __init__(self, model, app=None):
9494
9595 last_run_at = model .last_run_at
9696
97- if settings . DJANGO_CELERY_BEAT_TZ_AWARE :
97+ if getattr ( settings , ' DJANGO_CELERY_BEAT_TZ_AWARE' , True ) :
9898 last_run_at = make_aware (last_run_at )
9999
100100 self .last_run_at = last_run_at
@@ -133,7 +133,7 @@ def _default_now(self):
133133 # The PyTZ datetime must be localised for the Django-Celery-Beat
134134 # scheduler to work. Keep in mind that timezone arithmatic
135135 # 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 ) :
137137 now = now .tzinfo .localize (now .replace (tzinfo = None ))
138138 return now
139139
@@ -151,7 +151,7 @@ def save(self):
151151 for field in self .save_fields :
152152 setattr (obj , field , getattr (self .model , field ))
153153
154- if not settings . DJANGO_CELERY_BEAT_TZ_AWARE :
154+ if not getattr ( settings , ' DJANGO_CELERY_BEAT_TZ_AWARE' , True ) :
155155 obj .last_run_at = datetime .datetime .now ()
156156
157157 obj .save ()
0 commit comments