From 9b79ba271904b92c28e96992725d3942bdb07184 Mon Sep 17 00:00:00 2001 From: overflowerror Date: Wed, 28 May 2014 20:31:01 +0200 Subject: [PATCH] I CAN HAZ PYTHON, I CAN HAZ INDENTS --- server.py | 10 ++++++++++ templates/index.html | 7 ++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/server.py b/server.py index 59f9769..14977c9 100755 --- a/server.py +++ b/server.py @@ -49,6 +49,16 @@ def logout(): setuser('','') return redirect(url_for('index')) +@app.route('/diary/?new',methods=['POST']) +def newdiary(): + if not loggedin(): + abort(403) + d=Diary(session['id'], request.form['name']) + db.add(d) + db.commit() + return redirect(url_for('diary', name=request.form['name'])) + + @app.route('/diary/') def diary(name=''): if not loggedin(): diff --git a/templates/index.html b/templates/index.html index 2e80da4..6c3870f 100644 --- a/templates/index.html +++ b/templates/index.html @@ -7,7 +7,12 @@ -

Logout

+

+ Logout +

+ New diary: +
+