From 32d67bcd63571d61f090b613aba48ec4c710ae1a Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Wed, 30 Oct 2013 14:52:39 +0100 Subject: [PATCH 1/1] Update cache on collection edit. --- apps/catalogue/models/listeners.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/catalogue/models/listeners.py b/apps/catalogue/models/listeners.py index 788957e14..373a2fcc8 100644 --- a/apps/catalogue/models/listeners.py +++ b/apps/catalogue/models/listeners.py @@ -40,6 +40,14 @@ def _pre_delete_handler(sender, instance, **kwargs): pre_delete.connect(_pre_delete_handler) +def _post_delete_handler(sender, instance, **kwargs): + """ refresh Book on BookMedia delete """ + if sender == Collection: + permanent_cache.delete('catalogue.collection:%s' % instance.slug) + permanent_cache.delete('catalogue.catalogue') +post_delete.connect(_post_delete_handler) + + def _post_save_handler(sender, instance, **kwargs): """ refresh all the short_html stuff on BookMedia update """ if sender == BookMedia: @@ -48,6 +56,7 @@ def _post_save_handler(sender, instance, **kwargs): 'catalogue.audiobook_list', 'catalogue.daisy_list']) elif sender == Collection: permanent_cache.delete('catalogue.collection:%s' % instance.slug) + permanent_cache.delete('catalogue.catalogue') post_save.connect(_post_save_handler) -- 2.20.1