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
48cff6ef
Commit
48cff6ef
authored
2 years ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
Overview: Zakládání soutěží
Viz
#282
.
parent
25e55cf4
No related branches found
No related tags found
1 merge request
!123
Zakládání soutěží z orgovské hlavní stránky
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
mo/web/org.py
+9
-1
9 additions, 1 deletion
mo/web/org.py
mo/web/org_round.py
+18
-0
18 additions, 0 deletions
mo/web/org_round.py
mo/web/templates/org_index.html
+7
-1
7 additions, 1 deletion
mo/web/templates/org_index.html
with
34 additions
and
2 deletions
mo/web/org.py
+
9
−
1
View file @
48cff6ef
...
@@ -11,6 +11,7 @@ import mo.rights
...
@@ -11,6 +11,7 @@ import mo.rights
import
mo.users
import
mo.users
from
mo.web
import
app
from
mo.web
import
app
from
mo.web.jinja
import
user_url
from
mo.web.jinja
import
user_url
import
mo.web.org_round
from
mo.web.table
import
Table
,
Row
,
Column
from
mo.web.table
import
Table
,
Row
,
Column
...
@@ -103,7 +104,14 @@ def org_index():
...
@@ -103,7 +104,14 @@ def org_index():
get_stats
(
overview
)
get_stats
(
overview
)
overview
=
filter_overview
(
overview
)
overview
=
filter_overview
(
overview
)
return
render_template
(
'
org_index.html
'
,
overview
=
overview
,
role_type_names
=
db
.
role_type_names
)
form_add_contest
=
mo
.
web
.
org_round
.
AddContestForm
()
return
render_template
(
'
org_index.html
'
,
overview
=
overview
,
role_type_names
=
db
.
role_type_names
,
form_add_contest
=
form_add_contest
,
)
def
get_stats
(
overview
:
List
[
OrgOverview
])
->
None
:
def
get_stats
(
overview
:
List
[
OrgOverview
])
->
None
:
...
...
This diff is collapsed.
Click to expand it.
mo/web/org_round.py
+
18
−
0
View file @
48cff6ef
...
@@ -81,6 +81,7 @@ def delete_task(round_id: int, form: TaskDeleteForm) -> bool:
...
@@ -81,6 +81,7 @@ def delete_task(round_id: int, form: TaskDeleteForm) -> bool:
return
False
return
False
# Používá se i přehledu soutěží na orgovské hlavní stránce
class
AddContestForm
(
FlaskForm
):
class
AddContestForm
(
FlaskForm
):
place
=
mo_fields
.
Place
(
'
Nová soutěž v oblasti:
'
,
validators
=
[
validators
.
DataRequired
()])
place
=
mo_fields
.
Place
(
'
Nová soutěž v oblasti:
'
,
validators
=
[
validators
.
DataRequired
()])
create_contest
=
wtforms
.
SubmitField
(
'
Založit
'
)
create_contest
=
wtforms
.
SubmitField
(
'
Založit
'
)
...
@@ -702,3 +703,20 @@ def org_round_create_contests(round_id: int):
...
@@ -702,3 +703,20 @@ def org_round_create_contests(round_id: int):
form
=
form
,
form
=
form
,
num_new_places
=
len
(
new_places
),
num_new_places
=
len
(
new_places
),
)
)
# Používá se v zakládacím tlačítku v přehledu soutěží na orgovské hlavní stránce
@app.route
(
'
/org/contests/r/<int:round_id>/create-contest
'
,
methods
=
(
'
POST
'
,))
def
org_round_create_contest
(
round_id
:
int
):
sess
=
db
.
get_session
()
ctx
=
get_context
(
round_id
=
round_id
)
form_add_contest
=
AddContestForm
()
if
not
add_contest
(
ctx
.
round
,
form_add_contest
):
return
redirect
(
url_for
(
'
org_index
'
))
# Je jednodušší soutěž znovu najít, než se ji snažit vydolovat z mechanismu
# zakládání soutěží v dělených kolech.
contest
=
sess
.
query
(
db
.
Contest
).
filter_by
(
round
=
ctx
.
round
,
place
=
form_add_contest
.
place
.
place
).
first
()
assert
contest
is
not
None
return
redirect
(
ctx
.
url_for
(
'
org_contest
'
,
ct_id
=
contest
.
contest_id
))
This diff is collapsed.
Click to expand it.
mo/web/templates/org_index.html
+
7
−
1
View file @
48cff6ef
{% extends "base.html" %}
{% extends "base.html" %}
{% import "bootstrap/wtf.html" as wtf %}
{% block title %}Přístup pro organizátory{% endblock %}
{% block title %}Přístup pro organizátory{% endblock %}
{% block body %}
{% block body %}
...
@@ -61,7 +62,12 @@
...
@@ -61,7 +62,12 @@
{% endif %}
{% endif %}
<td>
{% for r in o.role_list %}{{ role_type_names[r] }}{% if not loop.last %}
<br>
{% endif %}{% endfor %}
<td>
{% for r in o.role_list %}{{ role_type_names[r] }}{% if not loop.last %}
<br>
{% endif %}{% endfor %}
{% if create %}
{% if create %}
<td><a
class=
"btn btn-xs btn-success"
href=
'{{ detail_url }}'
>
Založit
</a>
<td>
<form
action=
"{{ url_for('org_round_create_contest', round_id=o.round.round_id) }}"
method=
"POST"
class=
"form-inline"
>
{{ form_add_contest.csrf_token() }}
<input
name=
"place"
type=
hidden
value=
"{{ o.place.get_code() }}"
>
<input
class=
"btn btn-xs btn-success"
name=
"create_contest"
type=
"submit"
value=
"Založit"
>
</form>
{% else %}
{% else %}
<td><a
class=
"btn btn-xs btn-primary"
href=
'{{ detail_url }}'
>
Detail
</a>
<td><a
class=
"btn btn-xs btn-primary"
href=
'{{ detail_url }}'
>
Detail
</a>
{% endif %}
{% endif %}
...
...
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