Fix timezone issue

pull/1/head
Luca 3 years ago
parent 9afd3cf290
commit 4b1b2b13a5

@ -4,6 +4,7 @@ from django.shortcuts import reverse
from datetime import timedelta from datetime import timedelta
from django.utils import timezone from django.utils import timezone
from django.db.models import F, Count, Q, ExpressionWrapper, Case, When from django.db.models import F, Count, Q, ExpressionWrapper, Case, When
from django.template import Context, Template
from phonenumber_field.modelfields import PhoneNumberField from phonenumber_field.modelfields import PhoneNumberField
from dynamic_preferences.registries import global_preferences_registry from dynamic_preferences.registries import global_preferences_registry
@ -137,7 +138,10 @@ class ShiftRegistration(models.Model):
def send_reminder(self): def send_reminder(self):
url = reverse("shift", kwargs={"shiftid": self.shift.pk}) url = reverse("shift", kwargs={"shiftid": self.shift.pk})
text = f"Deine kontakt-Schicht beginnt um {self.shift.start_at.strftime('%H:%M')}, bitte komm 15 Minuten vorher an den Treffpunkt. https://kontakt.rocks{url}" template = Template(
'Deine kontakt-Schicht beginnt um {{ start_at|date:"H:i" }}, bitte komm 15 Minuten vorher an den Treffpunkt. https://kontakt.rocks{{ url }}'
)
text = template.render(Context({"start_at": self.shift.start_at, "url": url}))
msg = Message(to=self.helper, text=text) msg = Message(to=self.helper, text=text)
msg.save() msg.save()
self.reminder_sent = True self.reminder_sent = True

Loading…
Cancel
Save