from catalogue.models.tag import prefetched_relations
from catalogue import app_settings
from catalogue import tasks
-from wolnelektury.utils import makedirs
+from wolnelektury.utils import makedirs, cached_render, clear_cached_renders
bofh_storage = BofhFileSystemStorage()
parent = parent.parent
def flush_includes(self, languages=True):
+ clear_cached_renders(self.mini_box)
+ clear_cached_renders(self.mini_box_nolink)
if not languages:
return
if languages is True:
flush_ssi_includes([
template % (self.pk, lang)
for template in [
- '/katalog/b/%d/mini.%s.html',
- '/katalog/b/%d/mini_nolink.%s.html',
'/katalog/b/%d/short.%s.html',
'/katalog/b/%d/wide.%s.html',
'/api/include/book/%d.%s.json',
def cover_color(self):
return WLCover.epoch_colors.get(self.extra_info.get('epoch'), '#000000')
+ @cached_render('catalogue/book_mini_box.html')
+ def mini_box(self):
+ return {
+ 'book': self
+ }
+
+ @cached_render('catalogue/book_mini_box.html')
+ def mini_box_nolink(self):
+ return {
+ 'book': self,
+ 'no_link': True,
+ }
def add_file_fields():
for format_ in Book.formats: