Skip to content
Snippets Groups Projects
Commit ffebd363 authored by Jiří Kalvoda's avatar Jiří Kalvoda
Browse files

Fields: IntList

parent a780d04b
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !92. Comments created here will be created in the context of that merge request.
......@@ -40,6 +40,20 @@ class Decimal(wtforms.DecimalField):
return super(Decimal, self)._value()
class IntList(wtforms.StringField):
list = None
def __init__(self, label="", validators=None, **kwargs):
super().__init__(label, validators, **kwargs)
def pre_validate(field, form):
field.list = None
if field.data:
try:
field.list = mo.util.parse_int_list(field.data)
except mo.CheckError as e:
raise wtforms.ValidationError(str(e))
class Points(Decimal):
def __init__(self, label="Body", validators=None, **kwargs):
super().__init__(label, validators, **kwargs)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment