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>
|
||||||
<div class="card text-right">
|
<div class="card text-right">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
{{ object.event }}
|
{{ object.event }}<br />
|
||||||
|
{% if object.details %}
|
||||||
|
<small>{{ object.details }}</small>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="card-footer text-muted">
|
<div class="card-footer text-muted">
|
||||||
{% blocktrans trimmed with since=object.time|timesince time=object.time|time %}
|
{% 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(
|
instances = Feeding.objects.filter(child=child).filter(
|
||||||
start__range=(min_date, max_date)).order_by('-start')
|
start__range=(min_date, max_date)).order_by('-start')
|
||||||
for instance in instances:
|
for instance in instances:
|
||||||
|
details = None
|
||||||
|
if instance.amount:
|
||||||
|
details = _('Amount: %(amount).0f') % {
|
||||||
|
'amount': instance.amount,
|
||||||
|
}
|
||||||
events.append({
|
events.append({
|
||||||
'time': timezone.localtime(instance.start),
|
'time': timezone.localtime(instance.start),
|
||||||
'event': _('%(child)s started feeding.') % {
|
'event': _('%(child)s started feeding.') % {
|
||||||
'child': instance.child.first_name
|
'child': instance.child.first_name
|
||||||
},
|
},
|
||||||
|
'details': details,
|
||||||
'model_name': instance.model_name,
|
'model_name': instance.model_name,
|
||||||
'type': 'start'
|
'type': 'start'
|
||||||
})
|
})
|
||||||
|
@ -43,6 +49,7 @@ def get_objects(child, date):
|
||||||
'event': _('%(child)s finished feeding.') % {
|
'event': _('%(child)s finished feeding.') % {
|
||||||
'child': instance.child.first_name
|
'child': instance.child.first_name
|
||||||
},
|
},
|
||||||
|
'details': details,
|
||||||
'model_name': instance.model_name,
|
'model_name': instance.model_name,
|
||||||
'type': 'end'
|
'type': 'end'
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue