PonyConf/proposals/templatetags/proposals_tags.py
2016-10-05 21:46:59 +02:00

19 lines
364 B
Python

from django import template
from proposals.utils import markdown_to_html
register = template.Library()
@register.simple_tag
def markdown(value):
return markdown_to_html(value)
@register.filter('duration_format')
def duration_format(value):
value = int(value)
hours = int(value/60)
minutes = value%60
return '%d h %02d' % (hours, minutes)