|
|
@ -110,9 +110,21 @@ def timestamptodate(date, fmt=None):
|
|
|
|
def yesno(value, yes, no):
|
|
|
|
def yesno(value, yes, no):
|
|
|
|
return yes if value else no
|
|
|
|
return yes if value else no
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@jinjia.app_template_filter('formatfloat')
|
|
|
|
@jinjia.app_template_filter('formatfloat')
|
|
|
|
def formatfloat(value, decimals=1):
|
|
|
|
def formatfloat(value, decimals=1):
|
|
|
|
formatedstring = '%d' % value
|
|
|
|
formatedstring = '%d' % value
|
|
|
|
if (value % 1) != 0:
|
|
|
|
if (value % 1) != 0:
|
|
|
|
formatedstring = ('%s.%d' % (formatedstring, (value % 1) * 10**decimals)).rstrip('0')
|
|
|
|
formatedstring = ('%s.%d' % (formatedstring, (value % 1) * 10**decimals)).rstrip('0')
|
|
|
|
return formatedstring
|
|
|
|
return formatedstring
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@jinjia.app_template_filter('formatseriesindex')
|
|
|
|
|
|
|
|
def formatseriesindex_filter(series_index):
|
|
|
|
|
|
|
|
if series_index:
|
|
|
|
|
|
|
|
if int(series_index) - series_index == 0:
|
|
|
|
|
|
|
|
return int(series_index)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
return series_index
|
|
|
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
|
|
|
|