1 # -*- coding: utf-8 -*-
2 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 from django import template
6 from ssify import ssi_variable
7 from ssify.utils import ssi_cache_control
8 from ..models import Offer
9 from ..utils import sanitize_payment_title
11 register = template.Library()
14 @ssi_variable(register, patch_response=[ssi_cache_control(must_revalidate=True, max_age=0)])
15 def current_offer(request):
16 offer = Offer.current()
17 return offer.pk if offer is not None else None
20 register.filter(sanitize_payment_title)