As far as I know you have to write you're own template tag for this. Below is the one I've concocted based on the Django core timesince/timeuntil code that should output what you're after:
@register.simple_tag
def duration( duration ):
"""
Usage: {% duration timedelta %}
Returns seconds duration as weeks, days, hours, minutes, seconds
Based on core timesince/timeuntil
"""
def seconds_in_units(seconds):
"""
Returns a tuple containing the most appropriate unit for the
number of seconds supplied and the value in that units form.
>>> seconds_in_units(7700)
(2, 'hour')
"""
unit_totals = OrderedDict()
unit_limits = [
("week", 7 * 24 * 3600),
("day", 24 * 3600),
("hour", 3600),
("minute", 60),
("second", 1)
]
for unit_name, limit in unit_limits:
if seconds >= limit:
amount = int(float(seconds) / limit)
if amount != 1:
unit_name += 's' # dodgy pluralisation
unit_totals[unit_name] = amount
seconds = seconds - ( amount * limit )
return unit_totals;
if duration:
if isinstance( duration, datetime.timedelta ):
if duration.total_seconds > 0:
unit_totals = seconds_in_units( duration.total_seconds() )
return ', '.join([str(v)+" "+str(k) for (k,v) in unit_totals.iteritems()])
return 'None'