Skip to content

Cookieconsent tags

hypha.cookieconsent.templatetags.cookieconsent_tags

register module-attribute

register = Library()

cookie_banner

cookie_banner(context)
Source code in hypha/cookieconsent/templatetags/cookieconsent_tags.py
@register.inclusion_tag("includes/banner.html", takes_context=True)
def cookie_banner(context):
    request = context["request"]
    settings = CookieConsentSettings.load(request_or_site=request)
    show_banner = settings.cookieconsent_active and not request.COOKIES.get(
        "cookieconsent"
    )

    return {"show_banner": show_banner, "settings": settings}