خرید بک لینک

Vote count: 0

I can't figure out why Django retus Exception when I try to set time format in template.

This is a column in Django-tables2 table.

time_arrival = tables.TemplateColumn('{{record.time_arrival|time: "H:i"}}',verbose_name=u'Čas príchodu')

The time_arrival is an attribute of Reservation model which is a record in this table. When there is just {{ record.time_arrival }} it shows time in this format: 1 p.m. but I want to show 13:00 for example so I have to change the format.

This exception is being raised:

Exception Value: Could not parse the remainder: ': "H:i"' from 'record.time_arrival|time: "H:i"'

This is a time_arrival attribute in Reservation model:

time_arrival = models.TimeField(null=True, blank=True, verbose_name=u'Čas príletu')

Do you know where is the problem?

asked 4 mins ago

1 Answer

Vote count: 0

Remove the space between time: and "H:i"

{{record.time_arrival|time:"H:i"}}

answered 25 secs ago

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 19 مرداد 1395 ساعت: 3:24

صفحه بندی