X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/281e079a27d5f168d0a57c79b17850bc4fcc65a1..6034428b14b634d1801e2d8279b1a0863b918a48:/src/catalogue/signals.py?ds=sidebyside diff --git a/src/catalogue/signals.py b/src/catalogue/signals.py index f3cacaaf7..d3d6ec340 100644 --- a/src/catalogue/signals.py +++ b/src/catalogue/signals.py @@ -1,9 +1,9 @@ -# -*- coding: utf-8 -*- # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # 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 +51,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()