Add a Last Feeding Method card and rearrange child dashboard cards.

This commit is contained in:
Christopher Charbonneau Wells 2017-08-25 17:39:10 -04:00
parent 2320d31d48
commit 6939adccaa
3 changed files with 26 additions and 2 deletions

View File

@ -0,0 +1,15 @@
{% extends 'cards/feeding.html' %}
{% block header %}Last Feeding Method{% endblock %}
{% block title %}
<h2 class="display-4 text-center">{{ feeding.method }}</h2>
{% endblock %}
{% block content %}
{% if feeding.amount %}
<div class="text-muted">Amount: {{ feeding.amount }}oz.</div>
{% endif %}
{% endblock %}
{% block footer %}{{ feeding.end }}{% endblock %}

View File

@ -32,19 +32,20 @@
<div class="col-lg-4 col-sm-12">
<div class="row">
<div class="col-lg-12 col-sm-6">
{% card_diaperchange_last object %}
{% card_feeding_last object %}
{% card_feeding_last_method object %}
</div>
<div class="col-lg-12 col-sm-6">
{% card_tummytime_last object %}
{% card_sleep_last object %}
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 col-sm-12">
{% card_tummytime_last object %}
{% card_tummytime_day object %}
</div>
<div class="col-lg-4 col-md-6 col-sm-12">
{% card_diaperchange_last object %}
{% card_diaperchange_types object %}
</div>
</div>

View File

@ -20,6 +20,14 @@ def card_feeding_last(child):
return {'feeding': instance}
@register.inclusion_tag('cards/feeding_last_method.html')
def card_feeding_last_method(child):
"""Information about the most recent feeding _method_.
"""
instance = Feeding.objects.filter(child=child).order_by('-end').first()
return {'feeding': instance}
@register.inclusion_tag('cards/diaperchange_last.html')
def card_diaperchange_last(child):
"""Information about the most recent diaper change.