membershipworks: Use django.utils.timezone.now
instead of django.db.models.functions.Now
`Now()` produces incorrect results due to timezone mismatch, see https://code.djangoproject.com/ticket/31638
This commit is contained in:
parent
eeb83388e1
commit
c03c5ff2f0
@ -4,7 +4,7 @@ from urllib.parse import quote, urlencode
|
||||
|
||||
from django.conf import settings
|
||||
from django.core import mail
|
||||
from django.db.models.functions import Now
|
||||
from django.utils import timezone
|
||||
|
||||
from cmsmanage.django_q2_helper import q_task_group
|
||||
from cmsmanage.email import TemplatedMultipartEmail
|
||||
@ -62,8 +62,14 @@ class EventSurveyEmail(TemplatedMultipartEmail):
|
||||
@q_task_group("Send Event Survey Emails")
|
||||
def send_survey_emails():
|
||||
with mail.get_connection() as conn:
|
||||
# not using django.db.models.functions.Now() because of
|
||||
# timezone mismatch, see
|
||||
# https://code.djangoproject.com/ticket/31638
|
||||
for event in EventExt.objects.filter(
|
||||
occurred=True, should_survey=True, survey_email_sent=False, end__lt=Now()
|
||||
occurred=True,
|
||||
should_survey=True,
|
||||
survey_email_sent=False,
|
||||
end__lt=timezone.now(),
|
||||
):
|
||||
logger.info("Sending survey messages for event: %s", event)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user