Add a notes template, slightly alter query

This commit is contained in:
Raoul Snyman 2021-01-27 16:07:46 -07:00
parent 27e7624198
commit 9fb69bbf64
Signed by: raoul
GPG Key ID: F55BCED79626AE9C
3 changed files with 20 additions and 1 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
__pycache__
*.egg-info
*.sqlite
stickynotes.cfg

View File

@ -0,0 +1,18 @@
{% extends "base.html" %}
{% block content %}
<div class="row">
{% for note in notes %}
<div class="col-12">
<div class="card">
<div class="card-body">
{% if note.title %}
<h5 class="card-title"><a href="/{{note.url}}">{{note.title}}</a></h5>
{% else %}
<h5 class="card-title"><a href="/{{note.url}}">{{note.url}}</a></h5>
{% endif %}
</div>
</div>
</div>
{% endfor %}
</div>
{% endblock %}

View File

@ -132,7 +132,7 @@ def view(note_url):
:param note_url: The note to show
"""
note = StickyNote.query.filter(StickyNote.url == note_url).scalar()
note = StickyNote.query.filter(StickyNote.url == note_url).first()
if not note:
flash('That note does not exist', 'danger')
return redirect('/')