mirror of https://github.com/snachodog/mybuddy.git
Show feeding amount on timeline
This commit is contained in:
parent
ed1d6b779e
commit
e3b6f79c09
|
@ -52,7 +52,10 @@
|
|||
</div>
|
||||
<div class="card text-right">
|
||||
<div class="card-body">
|
||||
{{ object.event }}
|
||||
{{ object.event }}<br />
|
||||
{% if object.details %}
|
||||
<small>{{ object.details }}</small>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="card-footer text-muted">
|
||||
{% blocktrans trimmed with since=object.time|timesince time=object.time|time %}
|
||||
|
|
|
@ -30,11 +30,17 @@ def get_objects(child, date):
|
|||
instances = Feeding.objects.filter(child=child).filter(
|
||||
start__range=(min_date, max_date)).order_by('-start')
|
||||
for instance in instances:
|
||||
details = None
|
||||
if instance.amount:
|
||||
details = _('Amount: %(amount).0f') % {
|
||||
'amount': instance.amount,
|
||||
}
|
||||
events.append({
|
||||
'time': timezone.localtime(instance.start),
|
||||
'event': _('%(child)s started feeding.') % {
|
||||
'child': instance.child.first_name
|
||||
},
|
||||
'details': details,
|
||||
'model_name': instance.model_name,
|
||||
'type': 'start'
|
||||
})
|
||||
|
@ -43,6 +49,7 @@ def get_objects(child, date):
|
|||
'event': _('%(child)s finished feeding.') % {
|
||||
'child': instance.child.first_name
|
||||
},
|
||||
'details': details,
|
||||
'model_name': instance.model_name,
|
||||
'type': 'end'
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue