python - If, Else inside html using Django templates -


i have django project consists of many html pages.

i want add if else condition inside html tag return "none" whenever time stamp = 0000-00-00 00:00:00 , return time when it's not. code shown below, used tag time in date format.

<td>{{ table.start_time|date:"y-m-d g:i:s"}}</td>

i used tag:

<td>{{ table.start_time|date:"y-m-d g:i:s"|default:"none"}}</td>

thanks all!!


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -