Fix no date bug

This commit is contained in:
Götz 2019-02-05 17:57:41 +01:00
parent aaaa4d4716
commit e85a2fdda4
2 changed files with 35 additions and 31 deletions

View File

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

View File

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