use form.validate_on_submit() whenever possible
This commit is contained in:
parent
40f8c610d2
commit
aeb4108570
|
@ -34,8 +34,7 @@ def client_detail(client_id):
|
||||||
flash("you cannot see this client", "warning")
|
flash("you cannot see this client", "warning")
|
||||||
return redirect(url_for("developer.index"))
|
return redirect(url_for("developer.index"))
|
||||||
|
|
||||||
if request.method == "POST":
|
if form.validate_on_submit():
|
||||||
if form.validate():
|
|
||||||
client.name = form.name.data
|
client.name = form.name.data
|
||||||
client.home_url = form.home_url.data
|
client.home_url = form.home_url.data
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,7 @@ class NewClientForm(FlaskForm):
|
||||||
def new_client():
|
def new_client():
|
||||||
form = NewClientForm()
|
form = NewClientForm()
|
||||||
|
|
||||||
if request.method == "POST":
|
if form.validate_on_submit():
|
||||||
if form.validate():
|
|
||||||
client = Client.create_new(form.name.data, current_user.id)
|
client = Client.create_new(form.name.data, current_user.id)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue