fieldfile.save(None, File(open(out.get_filename())), save=False)
self.set_file_permissions(fieldfile)
if book.pk is not None:
- type(book).objects.filter(pk=book.pk).update(**{
+ books = type(book).objects.filter(pk=book.pk)
+ books.update(**{
fieldfile.field.attname: fieldfile
})
+ for book in books:
+ book.save() # just to trigger post-save
if fieldfile.field.format_name in app_settings.FORMAT_ZIPS:
remove_zip(app_settings.FORMAT_ZIPS[fieldfile.field.format_name])
# Don't decorate BuildEbook, because we want to subclass it.
#
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
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()