Add example "Last Feeding" dashboard card.

This commit is contained in:
Christopher Charbonneau Wells 2017-08-18 08:49:15 -04:00
parent b6ba6d440f
commit fe2b704d16
3 changed files with 31 additions and 7 deletions

View File

@ -1,4 +1,5 @@
{% extends 'babyblotter/page.html' %}
{% load dashboard_cards %}
{% block title %}Dashboard - {{ object }}{% endblock %}
@ -6,24 +7,24 @@
<h1 class="text-center">{{ object }}</h1>
<div class="container">
<div class="row align-items-start text-center">
<div class="col-sm-12 col-md-4 border">
awake time
<div class="col-sm-12 col-md-4">
{% feeding_last object %}
</div>
<div class="col-sm-12 col-md-4 border">
<div class="col-sm-12 col-md-4">
last feeding
</div>
<div class="col-sm-12 col-md-4 border">
<div class="col-sm-12 col-md-4">
change statistics
</div>
</div>
<div class="row align-items-start text-center">
<div class="col-sm-12 col-md-4 border">
<div class="col-sm-12 col-md-4">
tummy time for the day
</div>
<div class="col-sm-12 col-md-4 border">
<div class="col-sm-12 col-md-4">
available
</div>
<div class="col-sm-12 col-md-4 border">
<div class="col-sm-12 col-md-4">
available
</div>
</div>

View File

@ -0,0 +1,8 @@
<div class="card border-primary mb-3">
<div class="card-header text-white bg-primary">
<i class="fa fa-2x fa-spoon" aria-hidden="true"></i></div>
<div class="card-body text-primary">
<h4 class="card-title">Last Feeding</h4>
<p class="card-text text-muted small">{{ feeding }}</p>
</div>
</div>

View File

@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import template
from core.models import Feeding
register = template.Library()
@register.inclusion_tag('dashboard_cards/feeding_last.html')
def feeding_last(child):
feeding_instance = Feeding.objects.filter(child=child).last()
return {'feeding': feeding_instance}