mirror of https://github.com/snachodog/mybuddy.git
Show duration in timeline (#247)
This commit is contained in:
parent
dd3aa3bdb8
commit
beaf366079
|
@ -62,6 +62,11 @@
|
||||||
{% blocktrans trimmed with since=object.time|timesince time=object.time|time %}
|
{% blocktrans trimmed with since=object.time|timesince time=object.time|time %}
|
||||||
{{ since }} ago ({{ time }})
|
{{ since }} ago ({{ time }})
|
||||||
{% endblocktrans %}
|
{% endblocktrans %}
|
||||||
|
{% if object.duration %}
|
||||||
|
<div>
|
||||||
|
<small>Duration: {{ object.duration }}</small>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% if object.edit_link %}
|
{% if object.edit_link %}
|
||||||
<div>
|
<div>
|
||||||
<small><a href="{{ object.edit_link }}">Edit</a></small>
|
<small><a href="{{ object.edit_link }}">Edit</a></small>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils import timezone
|
from django.utils import timezone, timesince
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from core.models import DiaperChange, Feeding, Sleep, TummyTime
|
from core.models import DiaperChange, Feeding, Sleep, TummyTime
|
||||||
|
@ -64,6 +64,7 @@ def get_objects(child, date):
|
||||||
},
|
},
|
||||||
'details': details,
|
'details': details,
|
||||||
'edit_link': edit_link,
|
'edit_link': edit_link,
|
||||||
|
'duration': timesince.timesince(instance.start, now=instance.end),
|
||||||
'model_name': instance.model_name,
|
'model_name': instance.model_name,
|
||||||
'type': 'end'
|
'type': 'end'
|
||||||
})
|
})
|
||||||
|
@ -87,6 +88,7 @@ def get_objects(child, date):
|
||||||
'child': instance.child.first_name
|
'child': instance.child.first_name
|
||||||
},
|
},
|
||||||
'edit_link': edit_link,
|
'edit_link': edit_link,
|
||||||
|
'duration': timesince.timesince(instance.start, now=instance.end),
|
||||||
'model_name': instance.model_name,
|
'model_name': instance.model_name,
|
||||||
'type': 'end'
|
'type': 'end'
|
||||||
})
|
})
|
||||||
|
@ -110,6 +112,7 @@ def get_objects(child, date):
|
||||||
'child': instance.child.first_name
|
'child': instance.child.first_name
|
||||||
},
|
},
|
||||||
'edit_link': edit_link,
|
'edit_link': edit_link,
|
||||||
|
'duration': timesince.timesince(instance.start, now=instance.end),
|
||||||
'model_name': instance.model_name,
|
'model_name': instance.model_name,
|
||||||
'type': 'end'
|
'type': 'end'
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue