X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/575e58df64c98b53edca9fb6a29b284dbc375609..28cb104054903726b0556222929f8f2e9941882d:/apps/funding/templatetags/funding_tags.py diff --git a/apps/funding/templatetags/funding_tags.py b/apps/funding/templatetags/funding_tags.py index c533672b5..5331f8c4a 100755 --- a/apps/funding/templatetags/funding_tags.py +++ b/apps/funding/templatetags/funding_tags.py @@ -8,10 +8,22 @@ register = template.Library() def funding(offer=None, link=False, add_class=""): if offer is None: offer = Offer.current() + if offer is None: + return {} return { 'offer': offer, + 'is_current': offer.is_current(), 'percentage': 100 * offer.sum() / offer.target, 'link': link, 'add_class': add_class, } + + +@register.inclusion_tag("funding/tags/offer_detail_head.html") +def offer_detail_head(offer): + return { + 'offer': offer, + 'state': offer.state(), + } +