X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/e79ef640becb4b59dba11c1dfcce0ea87000919b..0072f1058b57e2744e5f448a98d9d0c2e6492898:/src/catalogue/models/book.py?ds=inline diff --git a/src/catalogue/models/book.py b/src/catalogue/models/book.py index 7cd6386ba..b71926ec3 100644 --- a/src/catalogue/models/book.py +++ b/src/catalogue/models/book.py @@ -770,6 +770,17 @@ class Book(models.Model): def ridero_link(self): return 'https://ridero.eu/%s/books/wl_%s/' % (get_language(), self.slug.replace('-', '_')) + def like(self, user): + from social.utils import likes, get_set, set_sets + if not likes(user, self): + tag = get_set(user, '') + set_sets(user, self, [tag]) + + def unlike(self, user): + from social.utils import likes, set_sets + if likes(user, self): + set_sets(user, self, []) + def add_file_fields(): for format_ in Book.formats: