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
MO-P
Odevzdávací Systém MO
Commits
5eae9d7c
Project 'mj/mo-submit' was moved to 'mo-p/osmo'. Please update any links and bookmarks that may still have the old path.
Commit
5eae9d7c
authored
Aug 1, 2021
by
Jiří Kalvoda
Browse files
Options
Downloads
Patches
Plain Diff
Fields: FormAddRole
parent
f9d98c05
Branches
Branches containing commit
No related tags found
1 merge request
!92
Používání mo.web.fields
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
mo/web/org_users.py
+3
-10
3 additions, 10 deletions
mo/web/org_users.py
mo/web/templates/org_org.html
+1
-1
1 addition, 1 deletion
mo/web/templates/org_org.html
with
4 additions
and
11 deletions
mo/web/org_users.py
+
3
−
10
View file @
5eae9d7c
...
@@ -300,7 +300,7 @@ def org_orgs():
...
@@ -300,7 +300,7 @@ def org_orgs():
class
FormAddRole
(
FlaskForm
):
class
FormAddRole
(
FlaskForm
):
role
=
wtforms
.
SelectField
(
'
Role
'
,
choices
=
db
.
RoleType
.
choices
(),
coerce
=
db
.
RoleType
.
coerce
,
render_kw
=
{
'
autofocus
'
:
True
})
role
=
wtforms
.
SelectField
(
'
Role
'
,
choices
=
db
.
RoleType
.
choices
(),
coerce
=
db
.
RoleType
.
coerce
,
render_kw
=
{
'
autofocus
'
:
True
})
place
_code
=
wtforms
.
StringField
(
'
Oblast
'
)
place
=
mo_fields
.
Place
(
)
year
=
wtforms
.
IntegerField
(
'
Ročník
'
,
validators
=
[
validators
.
Optional
()])
year
=
wtforms
.
IntegerField
(
'
Ročník
'
,
validators
=
[
validators
.
Optional
()])
category
=
wtforms
.
StringField
(
"
Kategorie
"
,
validators
=
[
validators
.
Length
(
max
=
2
)],
filters
=
[
lambda
x
:
x
or
None
])
category
=
wtforms
.
StringField
(
"
Kategorie
"
,
validators
=
[
validators
.
Length
(
max
=
2
)],
filters
=
[
lambda
x
:
x
or
None
])
seq
=
wtforms
.
IntegerField
(
"
Kolo
"
,
validators
=
[
validators
.
Optional
()])
seq
=
wtforms
.
IntegerField
(
"
Kolo
"
,
validators
=
[
validators
.
Optional
()])
...
@@ -360,14 +360,7 @@ def org_org(id: int):
...
@@ -360,14 +360,7 @@ def org_org(id: int):
new_role
.
assigned_by
=
g
.
user
.
user_id
new_role
.
assigned_by
=
g
.
user
.
user_id
ok
=
True
ok
=
True
place_code
=
form_add_role
.
place_code
.
data
new_role
.
place
=
form_add_role
.
place
.
place
if
place_code
:
place
=
db
.
get_place_by_code
(
place_code
)
if
not
place
:
role_errors
.
append
(
"
Nepovedlo se nalézt místo podle kódu
"
)
ok
=
False
else
:
new_role
.
place
=
place
if
not
g
.
gatekeeper
.
can_set_role
(
new_role
):
if
not
g
.
gatekeeper
.
can_set_role
(
new_role
):
role_errors
.
append
(
f
'
Roli
"
{
new_role
}
"
nelze přidělit, není podmnožinou žádné vaší role
'
)
role_errors
.
append
(
f
'
Roli
"
{
new_role
}
"
nelze přidělit, není podmnožinou žádné vaší role
'
)
...
...
This diff is collapsed.
Click to expand it.
mo/web/templates/org_org.html
+
1
−
1
View file @
5eae9d7c
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
<form
action=
""
method=
"POST"
class=
"form form-inline"
role=
"form"
>
<form
action=
""
method=
"POST"
class=
"form form-inline"
role=
"form"
>
{{ form_add_role.csrf_token() }}
{{ form_add_role.csrf_token() }}
{{ wtf.form_field(form_add_role.role) }}
{{ wtf.form_field(form_add_role.role) }}
{{ wtf.form_field(form_add_role.place
_code, placeholder='Kód'
, size=8) }}
{{ wtf.form_field(form_add_role.place, size=8) }}
{{ wtf.form_field(form_add_role.year, type='number', size=3, maxlength=2) }}
{{ wtf.form_field(form_add_role.year, type='number', size=3, maxlength=2) }}
{{ wtf.form_field(form_add_role.category, size=2, maxlength=2) }}
{{ wtf.form_field(form_add_role.category, size=2, maxlength=2) }}
{{ wtf.form_field(form_add_role.seq, type='number', size=3, maxlength=2) }}
{{ wtf.form_field(form_add_role.seq, type='number', size=3, maxlength=2) }}
...
...
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
sign in
to comment