Minor performance improvements for generating many subevents

This commit is contained in:
Raphael Michel
2020-05-06 16:19:46 +02:00
parent ea04c85486
commit feb7f419d3
2 changed files with 102 additions and 58 deletions

View File

@@ -1115,13 +1115,15 @@ class SubEvent(EventMixin, LoggedModel):
return not self.orderposition_set.exists()
def delete(self, *args, **kwargs):
clear_cache = kwargs.pop('clear_cache', False)
super().delete(*args, **kwargs)
if self.event:
if self.event and clear_cache:
self.event.cache.clear()
def save(self, *args, **kwargs):
clear_cache = kwargs.pop('clear_cache', False)
super().save(*args, **kwargs)
if self.event:
if self.event and clear_cache:
self.event.cache.clear()
@staticmethod