X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/33c8c74e2d709240d400edc0d8b08058403e5296..ac05eb781dae22cef8d2d08f5b039e18b3274344:/src/catalogue/models/book.py?ds=sidebyside diff --git a/src/catalogue/models/book.py b/src/catalogue/models/book.py index 3715e7b98..00921b899 100644 --- a/src/catalogue/models/book.py +++ b/src/catalogue/models/book.py @@ -615,6 +615,13 @@ class Book(models.Model): else: return None + def fragment_data(self): + fragment = self.choose_fragment() + if fragment: + return {'title': fragment.book.pretty_title(), 'html': fragment.get_short_text()} + else: + return None + def update_popularity(self): count = self.tags.filter(category='set').values('user').order_by('user').distinct().count() try: