mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-05-05 12:41:49 +02:00
Added Length validator
Added wtforms Length validator. Applied this validator to the bill amount because large values will crash an instance of the project.
This commit is contained in:
parent
915c832acc
commit
24657e1fff
1 changed files with 2 additions and 1 deletions
|
@ -20,6 +20,7 @@ from wtforms.validators import (
|
|||
NumberRange,
|
||||
Optional,
|
||||
ValidationError,
|
||||
Length,
|
||||
)
|
||||
|
||||
from ihatemoney.currency_convertor import CurrencyConverter
|
||||
|
@ -305,7 +306,7 @@ class BillForm(FlaskForm):
|
|||
date = DateField(_("When?"), validators=[DataRequired()], default=datetime.now)
|
||||
what = StringField(_("What?"), validators=[DataRequired()])
|
||||
payer = SelectField(_("Who paid?"), validators=[DataRequired()], coerce=int)
|
||||
amount = CalculatorStringField(_("How much?"), validators=[DataRequired()])
|
||||
amount = CalculatorStringField(_("How much?"), validators=[DataRequired(), Length(max=20)])
|
||||
currency_helper = CurrencyConverter()
|
||||
original_currency = SelectField(_("Currency"), validators=[DataRequired()])
|
||||
external_link = URLField(
|
||||
|
|
Loading…
Reference in a new issue