from django.db.models.signals import post_save, post_delete
from django.dispatch import receiver
from newtagging.models import tags_updated
-from picture.models import Picture, PictureArea
from .models import BookMedia, Book, Collection, Fragment, Tag
def tag_after_change(sender, instance, **kwargs):
caches[settings.CACHE_MIDDLEWARE_ALIAS].clear()
- for model in Book, Picture:
- for model_instance in model.tagged.with_all([instance]).only('pk'):
- model_instance.clear_cache()
+ for book in Book.tagged.with_all([instance]).only('pk'):
+ book.clear_cache()
@receiver(tags_updated)
return
caches[settings.CACHE_MIDDLEWARE_ALIAS].clear()
- if sender in (Book, Picture):
+ if sender in (Book,):
instance.clear_cache()