mirror of https://github.com/snachodog/mybuddy.git
Add basic template tag for timers.
This commit is contained in:
parent
6b2de93736
commit
463dd0c1d7
|
@ -1,4 +1,5 @@
|
|||
{% load static %}
|
||||
{% load timers %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
@ -56,9 +57,13 @@
|
|||
|
||||
<div id="view-{{ request.resolver_match.view_name }}" class="container-fluid">
|
||||
<div class="row justify-content-md-center">
|
||||
<div class="col-lg-8">
|
||||
<div class="col-lg-8 mb-4">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
<div class="col-lg-2">
|
||||
<h1>Timers</h1>
|
||||
{% list_timers %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{% for timer in timers %}
|
||||
{{ timer.name }} ({{ timer.duration }})
|
||||
{% endfor %}
|
|
@ -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}
|
Loading…
Reference in New Issue