fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
edit buttons
[wolnelektury.git]
/
src
/
catalogue
/
templatetags
/
catalogue_tags.py
diff --git
a/src/catalogue/templatetags/catalogue_tags.py
b/src/catalogue/templatetags/catalogue_tags.py
index
93b6f1c
..
f4f121d
100644
(file)
--- a/
src/catalogue/templatetags/catalogue_tags.py
+++ b/
src/catalogue/templatetags/catalogue_tags.py
@@
-530,8
+530,10
@@
def content_warning(book):
}
}
-@register.inclusion_tag('catalogue/preview_ad.html')
-def preview_ad():
+@register.inclusion_tag('catalogue/preview_ad.html', takes_context=True)
+def preview_ad(context):
+ book = Book.objects.filter(preview=True).first()
return {
return {
- 'book': Book.objects.filter(preview=True).first()
+ 'accessible': book.is_accessible_to(context['request'].user),
+ 'book': book,
}
}