fix: wrong logic in Club.delete()

This commit is contained in:
thomas girod
2024-06-26 11:39:07 +02:00
parent ae1fcdb8c0
commit 75bb3f992c
2 changed files with 13 additions and 15 deletions

View File

@ -207,11 +207,11 @@ class Club(models.Model):
cache.set(f"sith_club_{self.unix_name}", self)
def delete(self, *args, **kwargs):
super().delete(*args, **kwargs)
# Invalidate the cache of this club and of its memberships
for membership in self.members.ongoing().select_related("user"):
cache.delete(f"membership_{self.id}_{membership.user.id}")
cache.delete(f"sith_club_{self.unix_name}")
super().delete(*args, **kwargs)
def __str__(self):
return self.name