mirror of
https://github.com/sigmasternchen/Diary
synced 2025-03-15 15:18:57 +00:00
Added a form for adding entries
This commit is contained in:
parent
7cb9335c0a
commit
62624c9f57
2 changed files with 5 additions and 1 deletions
|
@ -69,7 +69,7 @@ def addentry(name=''):
|
||||||
e=Entry(d.id,request.form['text'])
|
e=Entry(d.id,request.form['text'])
|
||||||
db.add(e)
|
db.add(e)
|
||||||
db.commit()
|
db.commit()
|
||||||
return 'success'
|
return redirect(url_for('diary',name=name))
|
||||||
|
|
||||||
if __name__=='__main__':
|
if __name__=='__main__':
|
||||||
app.debug=True
|
app.debug=True
|
||||||
|
|
|
@ -8,6 +8,10 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<p>{{ diary.name }}:</p>
|
<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>
|
<div>
|
||||||
{% for e in entries %}
|
{% for e in entries %}
|
||||||
<p>
|
<p>
|
||||||
|
|
Loading…
Reference in a new issue