X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/5d1dcf0b143ba6409b66ca13ddf31143d6e00a59..0eedef1eafceaaa3f4f78b014236bf642be2807b:/src/catalogue/models/book.py diff --git a/src/catalogue/models/book.py b/src/catalogue/models/book.py index 9e0f7c8c7..97677bdee 100644 --- a/src/catalogue/models/book.py +++ b/src/catalogue/models/book.py @@ -226,6 +226,11 @@ class Book(models.Model): def isbn_mobi(self): return self.get_extra_info_json().get('isbn_mobi') + def is_accessible_to(self, user): + if not self.preview: + return True + Membership = apps.get_model('club', 'Membership') + return Membership.is_active_for(user) def save(self, force_insert=False, force_update=False, **kwargs): from sortify import sortify