aboutsummaryrefslogtreecommitdiff
path: root/ihatemoney/forms.py
diff options
context:
space:
mode:
Diffstat (limited to 'ihatemoney/forms.py')
-rw-r--r--ihatemoney/forms.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/ihatemoney/forms.py b/ihatemoney/forms.py
index d00b5fe..cce36e3 100644
--- a/ihatemoney/forms.py
+++ b/ihatemoney/forms.py
@@ -17,6 +17,13 @@ from ihatemoney.models import Project, Person
from ihatemoney.utils import slugify, eval_arithmetic_expression
+def strip_filter(string):
+ try:
+ return string.strip()
+ except Exception:
+ return string
+
+
def get_billform_for(project, set_default=True, **kwargs):
"""Return an instance of BillForm configured for a particular project.
@@ -170,7 +177,7 @@ class BillForm(FlaskForm):
class MemberForm(FlaskForm):
- name = StringField(_("Name"), validators=[DataRequired()])
+ name = StringField(_("Name"), validators=[DataRequired()], filters=[strip_filter, ])
weight_validators = [NumberRange(min=0.1, message=_("Weights should be positive"))]
weight = CommaDecimalField(_("Weight"), default=1,