From a5cc50b0c245f55e15e8fc43feed90dbbc6ab771 Mon Sep 17 00:00:00 2001 From: Tinmn Date: Sun, 20 Nov 2011 14:37:32 +0100 Subject: Addition of an auto hiding user information message in the add user text field (with translation). --- budget/forms.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'budget/forms.py') diff --git a/budget/forms.py b/budget/forms.py index f5c3fb5..7d8d8e1 100644 --- a/budget/forms.py +++ b/budget/forms.py @@ -141,7 +141,7 @@ class BillForm(Form): class MemberForm(Form): - name = TextField(_("Name"), validators=[Required()]) + name = TextField(_("Name"), validators=[Required()], default=_("Type user name here")) submit = SubmitField(_("Add")) def __init__(self, project, *args, **kwargs): @@ -149,6 +149,8 @@ class MemberForm(Form): self.project = project def validate_name(form, field): + if field.data == form.name.default: + raise ValidationError(_("User name incorrect")) if Person.query.filter(Person.name == field.data)\ .filter(Person.project == form.project)\ .filter(Person.activated == True).all(): -- cgit v1.1