django - DurationField format -
i have durationfield defined in model
day0 = models.durationfield('duration monday', default=datetime.timedelta) when try view this, want formatted "hh:mm" -- less 24. so, tried these in html template file:
{{ slice.day0|time:'h:m' }} {{ slice.day0|date:'h:m' }} however, empty space.
what doing wrong?
a timedelta instance not time or datetime. therefore not make sense use time or date filters.
django not come template filters display timedeltas, can either write own, or external app provides them. might find template filters in django-timedelta-field useful.
Comments
Post a Comment