Commit 1effd13f authored by Luko van der Maas's avatar Luko van der Maas
Browse files

fixed saving and cleaning off pizza events and normal events

parent dc617862
......@@ -347,10 +347,11 @@ class Event(models.Model, metaclass=ModelTranslateMeta):
f'{settings.BASE_URL}'
f'{reverse("events:event", args=[self.id])}')
registration_reminder.save()
self.registration_reminder = registration_reminder
self.registration_reminder.users.set(
Member.current_members.all())
registration_reminder.save()
elif registration_reminder.pk is not None:
self.registration_reminder = None
registration_reminder.delete()
......
......@@ -81,6 +81,8 @@ class PizzaEvent(models.Model):
})
def clean(self):
super().clean()
if self.start >= self.end:
raise ValidationError({
'start': _('The start is after the end of this event.'),
......@@ -96,7 +98,6 @@ class PizzaEvent(models.Model):
end_reminder.body_nl = "Je kan nog 10 minuten pizza's bestellen"
end_reminder.category = Category.objects.get(key='pizza')
end_reminder.time = self.end - timezone.timedelta(minutes=10)
end_reminder.save()
if self.event.registration_required:
end_reminder.users.set(self.event.registrations
......@@ -105,6 +106,8 @@ class PizzaEvent(models.Model):
else:
end_reminder.users.set(Member.current_members.all())
end_reminder.save()
self.end_reminder = end_reminder
elif (self.send_notification and self.end_reminder and
self._end != self.end):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment