X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/357027375ff8867f42ca34bcbfb5a78b5b185fc3..f177dd0cdb753827bd208960a159d1bbbaae9e80:/src/catalogue/models/fragment.py?ds=inline diff --git a/src/catalogue/models/fragment.py b/src/catalogue/models/fragment.py index a3dbdea54..dc159a59f 100644 --- a/src/catalogue/models/fragment.py +++ b/src/catalogue/models/fragment.py @@ -35,10 +35,17 @@ class Fragment(models.Model): def get_absolute_url(self): return '%s#m%s' % (reverse('book_text', args=[self.book.slug]), self.anchor) + def get_api_url(self): + return reverse('catalogue_api_fragment', args=[self.book.slug, self.anchor]) + def get_short_text(self): """Returns short version of the fragment.""" return self.short_text if self.short_text else self.text + @property + def themes(self): + return self.tags.filter(category='theme') + def flush_includes(self, languages=True): if not languages: return