fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
progress
[wolnelektury.git]
/
src
/
catalogue
/
signals.py
diff --git
a/src/catalogue/signals.py
b/src/catalogue/signals.py
index
72f8a89
..
7dd68d4
100644
(file)
--- a/
src/catalogue/signals.py
+++ b/
src/catalogue/signals.py
@@
-1,5
+1,5
@@
-# This file is part of Wolne
l
ektury, licensed under GNU Affero GPLv3 or later.
-# Copyright © Fundacja
Nowoczesna Polska
. See NOTICE for more information.
+# This file is part of Wolne
L
ektury, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja
Wolne Lektury
. See NOTICE for more information.
#
from django.conf import settings
from django.core.cache import caches
#
from django.conf import settings
from django.core.cache import caches
@@
-53,13
+53,6
@@
def book_save(sender, instance, **kwargs):
def book_delete(sender, instance, **kwargs):
caches[settings.CACHE_MIDDLEWARE_ALIAS].clear()
def book_delete(sender, instance, **kwargs):
caches[settings.CACHE_MIDDLEWARE_ALIAS].clear()
- if not settings.NO_SEARCH_INDEX:
- # remove the book from search index, when it is deleted.
- from search.index import Index
- idx = Index()
- idx.remove_book(instance)
- idx.index_tags()
-
####
# Tag
####
# Tag
@@
-74,11
+67,6
@@
def tag_after_change(sender, instance, **kwargs):
for model_instance in model.tagged.with_all([instance]).only('pk'):
model_instance.clear_cache()
for model_instance in model.tagged.with_all([instance]).only('pk'):
model_instance.clear_cache()
- if instance.category == 'author':
- for model in Fragment, PictureArea:
- for model_instance in model.tagged.with_all([instance]).only('pk'):
- model_instance.clear_cache()
-
@receiver(tags_updated)
def receive_tags_updated(sender, instance, affected_tags, **kwargs):
@receiver(tags_updated)
def receive_tags_updated(sender, instance, affected_tags, **kwargs):
@@
-87,4
+75,5
@@
def receive_tags_updated(sender, instance, affected_tags, **kwargs):
return
caches[settings.CACHE_MIDDLEWARE_ALIAS].clear()
return
caches[settings.CACHE_MIDDLEWARE_ALIAS].clear()
- instance.clear_cache()
+ if sender in (Book, Picture):
+ instance.clear_cache()