Basically usable funding workflow.
[wolnelektury.git] / apps / funding / templatetags / funding_tags.py
index c533672..5331f8c 100755 (executable)
@@ -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(),
+    }
+