mirror of
https://github.com/Mailu/Mailu.git
synced 2025-01-18 03:21:36 +02:00
Add missing import for validators, improve behaviour when an error occurs.
This commit is contained in:
parent
7d801c560c
commit
55a601de5a
@ -2,6 +2,7 @@ from mailu import models
|
||||
from mailu.ui import ui, forms, access
|
||||
from flask import current_app as app
|
||||
|
||||
import validators
|
||||
import flask
|
||||
import flask_login
|
||||
import wtforms_components
|
||||
@ -26,13 +27,13 @@ def domain_create():
|
||||
flask.flash('Domain %s is already used' % form.name.data, 'error')
|
||||
else:
|
||||
domain = models.Domain()
|
||||
form.populate_obj(domain)
|
||||
form.populate_obj(domain)
|
||||
models.db.session.add(domain)
|
||||
models.db.session.commit()
|
||||
flask.flash('Domain %s created' % domain)
|
||||
return flask.redirect(flask.url_for('.domain_list'))
|
||||
else:
|
||||
flask.flash('Domain %s is invalid' % form.name.data, 'error')
|
||||
return flask.redirect(flask.url_for('.domain_list'))
|
||||
return flask.render_template('domain/create.html', form=form)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user