This repository has been archived by the owner on Jan 21, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tag to format timedelta as hours:minutes (converts days to 24 hours)
- Loading branch information
1 parent
30ee826
commit 429c907
Showing
2 changed files
with
9 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from django import template | ||
|
||
register = template.Library() | ||
|
||
@register.filter | ||
def timedelta_fmt(td): | ||
secs = td.seconds + td.days * 24 * 3600 | ||
return "%d:%02d" % (secs/3600, secs%3600/60) |