Commit 503993f3 authored by Thijs de Jong's avatar Thijs de Jong
Browse files

Merge branch 'fix/remove-notifications-event-delete' into 'master'

Remove notifications on event delete

Closes #805

See merge request !1134
parents b64a2adf 46f21665
......@@ -390,6 +390,17 @@ class Event(models.Model, metaclass=ModelTranslateMeta):
super().save()
def delete(self, using=None, keep_parents=False):
if (self.registration_reminder is not None
and not self.registration_reminder.sent):
self.registration_reminder.delete()
if (self.start_reminder is not None
and not self.start_reminder.sent):
self.start_reminder.delete()
if self.is_pizza_event():
self.pizzaevent.delete()
return super().delete(using, keep_parents)
def __str__(self):
return '{}: {}'.format(
self.title,
......
......@@ -115,6 +115,12 @@ class PizzaEvent(models.Model):
super().save(*args, **kwargs)
def delete(self, using=None, keep_parents=False):
if (self.end_reminder is not None
and not self.end_reminder.sent):
self.end_reminder.delete()
return super().delete(using, keep_parents)
def __str__(self):
return 'Pizzas for ' + str(self.event)
......
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