use form.validate_on_submit() whenever possible

This commit is contained in:
Son NK 2019-08-16 10:32:38 +02:00
parent 40f8c610d2
commit aeb4108570
2 changed files with 34 additions and 36 deletions

View file

@ -34,8 +34,7 @@ def client_detail(client_id):
flash("you cannot see this client", "warning")
return redirect(url_for("developer.index"))
if request.method == "POST":
if form.validate():
if form.validate_on_submit():
client.name = form.name.data
client.home_url = form.home_url.data

View file

@ -18,8 +18,7 @@ class NewClientForm(FlaskForm):
def new_client():
form = NewClientForm()
if request.method == "POST":
if form.validate():
if form.validate_on_submit():
client = Client.create_new(form.name.data, current_user.id)
db.session.commit()