diff --git a/src/challenge/signals.py b/src/challenge/signals.py index c53b7e83..1a4756f1 100644 --- a/src/challenge/signals.py +++ b/src/challenge/signals.py @@ -1,11 +1,11 @@ from django.core.cache import caches -from django.db.models.signals import post_save +from django.db.models.signals import post_save, post_delete from django.dispatch import receiver from challenge.models import Challenge -@receiver(post_save, sender=Challenge) -def challenge_save(sender, instance, **kwargs): +@receiver([post_save, post_delete], sender=Challenge) +def challenge_cache_invalidate(sender, instance, **kwargs): new_index = caches["default"].get("challenge_mod_index", 0) + 1 caches["default"].set("challenge_mod_index", new_index)