diff --git a/app.py b/app.py index a39aa81..543e4e9 100644 --- a/app.py +++ b/app.py @@ -29,8 +29,11 @@ def book(id): @app.route("/book//mark", methods=["POST"]) def bookmark(id): page = request.form["page"] + note = request.form["note"] csr = get_cursor() - csr.execute("insert into bookmarks(book, page) values(%s, %s)", (id, page,)) + csr.execute( + "insert into bookmarks(book, page, note) values(%s, %s, %s)", + (id, page, note)) return redirect(url_for("book", id=id), code=303) @app.route("/book/new", methods=["POST"]) diff --git a/templates/book.html b/templates/book.html index 7cad313..27bef4b 100644 --- a/templates/book.html +++ b/templates/book.html @@ -6,29 +6,43 @@ Lesetagebuch: {{book.title}}

{{ book.title }}

- + +
{% for bookmark in bookmarks %} - - - - + + + + + + + + + {% endfor %}
- {{bookmark.ts.strftime("%Y-%m-%d %H:%M%z")}} - - {{bookmark.page}} -
+ {{bookmark.ts.strftime("%Y-%m-%d %H:%M%z")}} + + {{bookmark.page}} +
+ {% if bookmark.note %} + {{bookmark.note}} + {% endif %} +