1
0
mirror of https://github.com/Mailu/Mailu.git synced 2024-12-14 10:53:30 +02:00

Fix the behaviour from Wtforms Components regarding readonly, related to #152

This commit is contained in:
Pierre Jaury 2017-01-25 00:05:03 +01:00
parent a74c9a1e87
commit 41b1666609
3 changed files with 3 additions and 0 deletions

View File

@ -41,6 +41,7 @@ def alias_edit(alias):
alias = models.Alias.query.get(alias) or flask.abort(404)
form = forms.AliasForm(obj=alias)
wtforms_components.read_only(form.localpart)
form.localpart.validators = []
if form.validate_on_submit():
form.populate_obj(alias)
db.session.commit()

View File

@ -34,6 +34,7 @@ def domain_edit(domain_name):
domain = models.Domain.query.get(domain_name) or flask.abort(404)
form = forms.DomainForm(obj=domain)
wtforms_components.read_only(form.name)
form.name.validators = []
if form.validate_on_submit():
form.populate_obj(domain)
db.session.commit()

View File

@ -44,6 +44,7 @@ def user_edit(user_email):
form = forms.UserForm(obj=user)
wtforms_components.read_only(form.localpart)
form.pw.validators = []
form.localpart.validators = []
if form.validate_on_submit():
form.populate_obj(user)
if form.pw.data: