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,38 +16,40 @@
</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"
<thead> width="100%">
<tr> <thead>
<th>id</th> <tr>
<th>title</th> <th>id</th>
<th>alias</th> <th>title</th>
<th>last change at</th> <th>alias</th>
<th>permission</th> <th>last change at</th>
<th>content</th> <th>permission</th>
</tr> <th>content</th>
</thead> </tr>
<tbody> </thead>
{% for note in notes %} <tbody>
<tr> {% for note in notes %}
<td scope="row"><a href="{{host}}/{{note['shortid']}}" target="_blank">{{note['shortid']}}</a></td> <tr>
<td>{{note['title']}}</td> <td scope="row"><a href="{{host}}/{{note['shortid']}}" target="_blank">{{note['shortid']}}</a></td>
<td>{{note['alias']}}</td> <td>{{note['title']}}</td>
<td><span class="note-date">{{note['lastchangeAt'].strftime('%Y-%m-%d %H:%M')}}</span></td> <td>{{note['alias']}}</td>
<td>{{note['permission']}}</td> <td><span class="note-date">{% if note['lastchangeAt'] %}{{note['lastchangeAt'].strftime('%Y-%m-%d %H:%M')}}{% endif %}</span>
<td>{%if note['content']%}💬{%else%}❌{%endif%}</td> </td>
</tr> <td>{{note['permission']}}</td>
{% endfor %} <td>{%if note['content']%}💬{%else%}❌{%endif%}</td>
</tbody> </tr>
</table> {% endfor %}
</div> </tbody>
</table>
</div>
</body> </body>