make sure alert is set to success/something, even if we are just getting an author - it was unset in this scenario
This commit is contained in:
2
main.py
2
main.py
@@ -166,6 +166,7 @@ def authors():
|
|||||||
@app.route("/author/<id>", methods=["GET", "POST"])
|
@app.route("/author/<id>", methods=["GET", "POST"])
|
||||||
def author(id):
|
def author(id):
|
||||||
### DDP: should this be request.form or request.values?
|
### DDP: should this be request.form or request.values?
|
||||||
|
alert="Success"
|
||||||
author_form = AuthorForm(request.form)
|
author_form = AuthorForm(request.form)
|
||||||
if request.method == 'POST' and author_form.validate():
|
if request.method == 'POST' and author_form.validate():
|
||||||
id = request.form['id']
|
id = request.form['id']
|
||||||
@@ -181,7 +182,6 @@ def author(id):
|
|||||||
author.surname = request.form['surname']
|
author.surname = request.form['surname']
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
message="Successfully Updated Author (id={})".format(id)
|
message="Successfully Updated Author (id={})".format(id)
|
||||||
alert="Success"
|
|
||||||
else:
|
else:
|
||||||
author = Author.query.get(id)
|
author = Author.query.get(id)
|
||||||
author_form = AuthorForm(request.values, obj=author)
|
author_form = AuthorForm(request.values, obj=author)
|
||||||
|
|||||||
Reference in New Issue
Block a user