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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Mareš
Odevzdávací Systém MO
Commits
8f80f9e1
Commit
8f80f9e1
authored
2 years ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
Kód místa nesmí být složen jenom z číslic
See
#329
.
parent
918023b9
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mo/web/org_place.py
+7
-1
7 additions, 1 deletion
mo/web/org_place.py
with
7 additions
and
1 deletion
mo/web/org_place.py
+
7
−
1
View file @
8f80f9e1
...
@@ -2,6 +2,7 @@ from flask import render_template, g, redirect, url_for, flash, request
...
@@ -2,6 +2,7 @@ from flask import render_template, g, redirect, url_for, flash, request
from
flask_wtf
import
FlaskForm
from
flask_wtf
import
FlaskForm
import
locale
import
locale
from
markupsafe
import
Markup
from
markupsafe
import
Markup
import
re
from
sqlalchemy
import
func
,
and_
from
sqlalchemy
import
func
,
and_
from
sqlalchemy.orm
import
joinedload
from
sqlalchemy.orm
import
joinedload
from
typing
import
List
,
Optional
from
typing
import
List
,
Optional
...
@@ -110,8 +111,13 @@ class PlaceEditForm(FlaskForm):
...
@@ -110,8 +111,13 @@ class PlaceEditForm(FlaskForm):
submit
=
wtforms
.
SubmitField
(
'
Uložit
'
)
submit
=
wtforms
.
SubmitField
(
'
Uložit
'
)
def
validate_code
(
form
:
FlaskForm
,
field
:
mo_fields
.
String
)
->
None
:
def
validate_code
(
form
:
FlaskForm
,
field
:
mo_fields
.
String
)
->
None
:
if
field
.
data
is
not
None
and
field
.
data
.
startswith
(
'
#
'
):
code
=
field
.
data
if
code
is
None
:
pass
elif
code
.
startswith
(
'
#
'
):
raise
wtforms
.
ValidationError
(
'
Kód nesmí začínat na znak
"
#
"
.
'
)
raise
wtforms
.
ValidationError
(
'
Kód nesmí začínat na znak
"
#
"
.
'
)
elif
re
.
fullmatch
(
r
'
\d+
'
,
code
):
raise
wtforms
.
ValidationError
(
'
Kód nesmí být složen pouze z číslic.
'
)
class
PlaceSchoolEditForm
(
PlaceEditForm
):
class
PlaceSchoolEditForm
(
PlaceEditForm
):
...
...
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