from django.contrib.contenttypes.fields import GenericRelation
from django.urls import reverse
from django.db import models
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
from newtagging import managers
from catalogue.models import Tag
from wolnelektury.utils import cached_render, clear_cached_renders
"""Returns short version of the fragment."""
return self.short_text if self.short_text else self.text
- @cached_render('catalogue/fragment_short.html')
- def midi_box(self):
- return {'fragment': self}
-
- @cached_render('catalogue/fragment_promo.html')
- def promo_box(self):
- return {'fragment': self}
-
@property
def themes(self):
return self.tags.filter(category='theme')
-
- def clear_cache(self):
- clear_cached_renders(self.midi_box)
- clear_cached_renders(self.promo_box)