adapted date format to Ymd such that its string representation is properly sortable

This commit is contained in:
Boockmann 2019-02-06 19:49:31 +01:00
commit 1f0294f4ac
2 changed files with 35 additions and 31 deletions

View File

@ -26,6 +26,7 @@ def main():
def production(): def production():
import config import config
print('PRODUKTION')
DB_HOST = os.environ.get('DB_HOST') DB_HOST = os.environ.get('DB_HOST')
DB_NAME = os.environ.get('POSTGRES_DB') DB_NAME = os.environ.get('POSTGRES_DB')
DB_USER = os.environ.get('POSTGRES_USER') DB_USER = os.environ.get('POSTGRES_USER')
@ -46,6 +47,7 @@ def production():
'lastchangeAt': note[5], 'permission': note[6], 'content': note[7]}) 'lastchangeAt': note[5], 'permission': note[6], 'content': note[7]})
return render_template('index.html', notes=notes_arr, host=config.CODI_URL) return render_template('index.html', notes=notes_arr, host=config.CODI_URL)
except Exception as e: except Exception as e:
print(e)
return render_template('index.html') return render_template('index.html')

View File

@ -16,14 +16,15 @@
</head> </head>
<body> <body>
<nav class="navbar navbar-light bg-light"> <nav class="navbar navbar-light bg-light">
<a class="navbar-brand" href="#"> <a class="navbar-brand" href="#">
<h1>CodiMD notes</h1> <h1>CodiMD notes</h1>
</a> </a>
</nav> </nav>
<div class="container"> <div class="container">
<table id="example" class="table table-striped table-inverse table-bordered table-hover" cellspacing="0" width="100%"> <table id="example" class="table table-striped table-inverse table-bordered table-hover" cellspacing="0"
width="100%">
<thead> <thead>
<tr> <tr>
<th>id</th> <th>id</th>
@ -40,14 +41,15 @@
<td scope="row"><a href="{{host}}/{{note['shortid']}}" target="_blank">{{note['shortid']}}</a></td> <td scope="row"><a href="{{host}}/{{note['shortid']}}" target="_blank">{{note['shortid']}}</a></td>
<td>{{note['title']}}</td> <td>{{note['title']}}</td>
<td>{{note['alias']}}</td> <td>{{note['alias']}}</td>
<td><span class="note-date">{{note['lastchangeAt'].strftime('%Y-%m-%d %H:%M')}}</span></td> <td><span class="note-date">{% if note['lastchangeAt'] %}{{note['lastchangeAt'].strftime('%Y-%m-%d %H:%M')}}{% endif %}</span>
</td>
<td>{{note['permission']}}</td> <td>{{note['permission']}}</td>
<td>{%if note['content']%}💬{%else%}❌{%endif%}</td> <td>{%if note['content']%}💬{%else%}❌{%endif%}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
</div> </div>
</body> </body>