Skip to content
Snippets Groups Projects
Commit 23290227 authored by Carlos Vega's avatar Carlos Vega
Browse files

added filter to get seconds from datetime

parent 91bb408a
No related branches found
No related tags found
1 merge request!233Feature/provenance
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
from django import template from django import template
from django.forms import CheckboxSelectMultiple, CheckboxInput from django.forms import CheckboxSelectMultiple, CheckboxInput
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
import datetime
register = template.Library() register = template.Library()
...@@ -40,3 +41,8 @@ def render_appointments(statistics, appointment_type): ...@@ -40,3 +41,8 @@ def render_appointments(statistics, appointment_type):
for status_count in statistics.get(appointment_type, []): for status_count in statistics.get(appointment_type, []):
html += '<td>{}</td>'.format(status_count) html += '<td>{}</td>'.format(status_count)
return mark_safe(html) return mark_safe(html)
@register.filter(name="timestamp")
def timestamp(value):
epoch = datetime.datetime.utcfromtimestamp(0)
return (value.replace(tzinfo=None) - epoch).total_seconds()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment