diff --git a/main.py b/main.py index 2e8decc..d0fa8c6 100644 --- a/main.py +++ b/main.py @@ -4,12 +4,12 @@ from flask import Flask, render_template, request app = Flask(__name__) app.debug = True -sql_statement = 'SELECT "id","title" FROM "Notes";' +sql_statement = 'SELECT "id","title","alias","shortid","viewcount","lastchangeAt" FROM "Notes";' HOST = '192.168.0.3' DB = 'hackmd' USER = 'hackmd' PASSWORD = 'osHx34e4aDazGsER' - +#lastchangeAt, alias, viewcount @app.route("/") def main(): @@ -17,12 +17,11 @@ def main(): cur = conn.cursor() cur.execute(sql_statement) print("The number of parts: ", cur.rowcount) - res = cur.fetchall() - print(res) + notes = cur.fetchall() + print(notes) cur.close() conn.close() - return render_template('index.html', - notes=res) + return render_template('index.html', notes=notes) if __name__ == '__main__': diff --git a/templates/index.html b/templates/index.html index 989b54e..cb5479c 100644 --- a/templates/index.html +++ b/templates/index.html @@ -15,9 +15,24 @@
{{note[1]}}
+ {% if note[1] and note[2] %} + + {% endif %} {% endfor %}