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

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -