fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Overdue fix.
[wolnelektury.git]
/
src
/
catalogue
/
models
/
book.py
diff --git
a/src/catalogue/models/book.py
b/src/catalogue/models/book.py
index
9e0f7c8
..
d3eddfd
100644
(file)
--- 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 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
def save(self, force_insert=False, force_update=False, **kwargs):
from sortify import sortify
@@
-831,7
+836,7
@@
class Book(models.Model):
def related_themes(self):
return Tag.objects.usage_for_queryset(
Fragment.objects.filter(models.Q(book=self) | models.Q(book__ancestor=self)),
def related_themes(self):
return Tag.objects.usage_for_queryset(
Fragment.objects.filter(models.Q(book=self) | models.Q(book__ancestor=self)),
- counts=True).filter(category='theme')
+ counts=True).filter(category='theme')
.order_by('-count')
def parent_cover_changed(self):
"""Called when parent book's cover image is changed."""
def parent_cover_changed(self):
"""Called when parent book's cover image is changed."""