diff --git a/core/templates/core/base.html b/core/templates/core/base.html index 6851e31c..30d1b5bf 100644 --- a/core/templates/core/base.html +++ b/core/templates/core/base.html @@ -1,4 +1,5 @@ {% load static %} +{% load timers %} @@ -56,9 +57,13 @@
-
+
{% block content %}{% endblock %}
+
+

Timers

+ {% list_timers %} +
diff --git a/core/templates/timer_list.html b/core/templates/timer_list.html new file mode 100644 index 00000000..bdfedd6e --- /dev/null +++ b/core/templates/timer_list.html @@ -0,0 +1,3 @@ +{% for timer in timers %} + {{ timer.name }} ({{ timer.duration }}) +{% endfor %} \ No newline at end of file diff --git a/core/templatetags/__init__.py b/core/templatetags/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/core/templatetags/timers.py b/core/templatetags/timers.py new file mode 100644 index 00000000..1ada1743 --- /dev/null +++ b/core/templatetags/timers.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django import template + +from core.models import Timer + + +register = template.Library() + + +@register.inclusion_tag('timer_list.html') +def list_timers(active=True): + timers = Timer.objects.filter(active=active) + return {'timers': timers}