Remove redundant form validation

master
Steven Loria 11 years ago
parent 1c92ba7a1b
commit 41ccc34e83
  1. 11
      {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/public/views.py

@ -51,13 +51,10 @@ def register():
email=form.email.data, email=form.email.data,
password=form.password.data, password=form.password.data,
active=True) active=True)
try: db.session.add(new_user)
db.session.add(new_user) db.session.commit()
db.session.commit() flash("Thank you for registering. You can now log in.", 'success')
flash("Thank you for registering. You can now log in.", 'success') return redirect(url_for('public.home'))
return redirect(url_for('public.home'))
except IntegrityError as err:
flash("That username and/or email already exists. Try again.", 'warning')
else: else:
flash_errors(form) flash_errors(form)
return render_template('public/register.html', form=form) return render_template('public/register.html', form=form)

Loading…
Cancel
Save