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

java - HTTP Status 500 - An exception occurred processing JSP page /second.jsp at line 15 -

php - Using str_replace to translate a MySQL Table in html -

asp.net mvc - Cannot display error message on Editor or EditorFor -