Verified Commit 46f21665 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Also delete pizza event

parent e1c8a6db
...@@ -397,6 +397,8 @@ class Event(models.Model, metaclass=ModelTranslateMeta): ...@@ -397,6 +397,8 @@ class Event(models.Model, metaclass=ModelTranslateMeta):
if (self.start_reminder is not None if (self.start_reminder is not None
and not self.start_reminder.sent): and not self.start_reminder.sent):
self.start_reminder.delete() self.start_reminder.delete()
if self.is_pizza_event():
self.pizzaevent.delete()
return super().delete(using, keep_parents) return super().delete(using, keep_parents)
def __str__(self): def __str__(self):
......
...@@ -115,6 +115,12 @@ class PizzaEvent(models.Model): ...@@ -115,6 +115,12 @@ class PizzaEvent(models.Model):
super().save(*args, **kwargs) 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): def __str__(self):
return 'Pizzas for ' + str(self.event) 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