2017-07-30 14:57:38 +00:00
|
|
|
from django import template
|
|
|
|
|
|
|
|
from cfp.utils import is_staff
|
|
|
|
|
|
|
|
|
|
|
|
register = template.Library()
|
|
|
|
|
|
|
|
|
|
|
|
@register.filter
|
|
|
|
def staff(request):
|
|
|
|
return is_staff(request, request.user)
|
2017-08-02 18:25:43 +00:00
|
|
|
|
2017-09-27 19:53:35 +00:00
|
|
|
|
|
|
|
@register.filter(name='duration_format')
|
2017-08-02 18:25:43 +00:00
|
|
|
def duration_format(value):
|
|
|
|
value = int(value)
|
|
|
|
hours = int(value/60)
|
|
|
|
minutes = value%60
|
|
|
|
return '%d h %02d' % (hours, minutes)
|