@register.inclusion_tag('catalogue/preview_ad.html', takes_context=True)
def preview_ad(context):
book = Book.objects.filter(parent=None, preview=True).first()
+ if book is None:
+ return {}
return {
'accessible': book.is_accessible_to(context['request'].user),
'book': book,
@register.inclusion_tag('catalogue/preview_ad_homepage.html', takes_context=True)
def preview_ad_homepage(context):
book = Book.objects.filter(parent=None, preview=True).first()
+ if book is None:
+ return {}
return {
'accessible': book.is_accessible_to(context['request'].user),
'book': book,