X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/2983d583c9de4c33ed73d6c06d9d6eb54b30f15e..10b367c03d1e3a8ad6e365b02a7234bfd640e3f6:/src/catalogue/signals.py?ds=sidebyside diff --git a/src/catalogue/signals.py b/src/catalogue/signals.py index f3cacaaf7..28d84bece 100644 --- a/src/catalogue/signals.py +++ b/src/catalogue/signals.py @@ -4,6 +4,7 @@ # from django.conf import settings from django.core.cache import caches +from django.core.exceptions import ImproperlyConfigured from django.db.models.signals import post_save, post_delete from django.dispatch import receiver from ssify import flush_ssi_includes @@ -51,6 +52,11 @@ def collection_delete(sender, instance, **kwargs): def book_save(sender, instance, **kwargs): # Books come out anywhere. caches[settings.CACHE_MIDDLEWARE_ALIAS].clear() + # deleting selectively is too much work + try: + caches['template_fragments'].clear() + except ImproperlyConfigured: + pass instance.flush_includes()