Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Odevzdávací Systém MO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Mareš
Odevzdávací Systém MO
Commits
de119c89
Commit
de119c89
authored
3 years ago
by
Jiří Kalvoda
Browse files
Options
Downloads
Patches
Plain Diff
Fields: IntList
parent
17e102b7
No related branches found
No related tags found
1 merge request
!92
Používání mo.web.fields
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mo/web/fields.py
+14
-0
14 additions, 0 deletions
mo/web/fields.py
with
14 additions
and
0 deletions
mo/web/fields.py
+
14
−
0
View file @
de119c89
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment