Timeline: Show diaper change details

This commit is contained in:
Ohad Lutzky 2021-07-06 21:48:08 +01:00 committed by Christopher Charbonneau Wells
parent e2e73d236d
commit 8861933738
1 changed files with 8 additions and 0 deletions

View File

@ -19,11 +19,19 @@ def get_objects(child, date):
instances = DiaperChange.objects.filter(child=child).filter(
time__range=(min_date, max_date)).order_by('-time')
for instance in instances:
contents = []
if instance.wet:
contents.append('💧wet')
if instance.solid:
contents.append('💩solid')
events.append({
'time': timezone.localtime(instance.time),
'event': _('%(child)s had a diaper change.') % {
'child': child.first_name
},
'details': _('Contents: %(contents)s') % {
'contents': ', '.join(contents),
},
'model_name': instance.model_name,
})