X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/807d88a6bbd34865987b59a757e7b4ef3b3fc718..a4cf06ec9135a9375fbc9ed2c697bc60ad6052b5:/src/catalogue/templatetags/catalogue_tags.py diff --git a/src/catalogue/templatetags/catalogue_tags.py b/src/catalogue/templatetags/catalogue_tags.py index 93b6f1c42..f4f121d80 100644 --- 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 { - 'book': Book.objects.filter(preview=True).first() + 'accessible': book.is_accessible_to(context['request'].user), + 'book': book, }