Added a form for adding entries

This commit is contained in:
benaryorg 2014-05-25 15:54:54 +02:00
parent 7cb9335c0a
commit 62624c9f57
2 changed files with 5 additions and 1 deletions

View file

@ -69,7 +69,7 @@ def addentry(name=''):
e=Entry(d.id,request.form['text'])
db.add(e)
db.commit()
return 'success'
return redirect(url_for('diary',name=name))
if __name__=='__main__':
app.debug=True

View file

@ -8,6 +8,10 @@
</head>
<body>
<p>{{ diary.name }}:</p>
<form action="{{ url_for('addentry',name=diary.name) }}" method="POST">
<input type="textarea" name="text" autofocus>
<button type="submit">Submit</button>
</form>
<div>
{% for e in entries %}
<p>