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

Fields: ParticipantsActionForm

Oblast se bude zadávat pomocí mo_fields.
parent ab33db00
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.
...@@ -90,12 +90,12 @@ class ParticipantsActionForm(FlaskForm): ...@@ -90,12 +90,12 @@ class ParticipantsActionForm(FlaskForm):
participation_state = wtforms.SelectField('Stav účasti', choices=db.PartState.choices(), coerce=db.PartState.coerce) participation_state = wtforms.SelectField('Stav účasti', choices=db.PartState.choices(), coerce=db.PartState.coerce)
set_participation_state = wtforms.SubmitField("Nastavit stav účasti") set_participation_state = wtforms.SubmitField("Nastavit stav účasti")
participation_place = wtforms.StringField( participation_place = mo_fields.Place(
'Soutěžní místo', description='Zadejte kód místa' 'Soutěžní místo', description='Zadejte kód místa'
) )
set_participation_place = wtforms.SubmitField("Nastavit soutěžní místo") set_participation_place = wtforms.SubmitField("Nastavit soutěžní místo")
contest_place = wtforms.StringField( contest_place = mo_fields.Place(
'Soutěžní oblast', 'Soutěžní oblast',
description='Musí existovat soutěž v dané oblasti pro stejné kolo. Oblast zadejte pomocí kódu.' description='Musí existovat soutěž v dané oblasti pro stejné kolo. Oblast zadejte pomocí kódu.'
) )
...@@ -116,15 +116,9 @@ class ParticipantsActionForm(FlaskForm): ...@@ -116,15 +116,9 @@ class ParticipantsActionForm(FlaskForm):
if self.set_participation_state.data: if self.set_participation_state.data:
pass pass
elif self.set_participation_place.data: elif self.set_participation_place.data:
participation_place = db.get_place_by_code(self.participation_place.data) participation_place = self.participation_place.place
if not participation_place:
flash('Nenalezeno místo s daným kódem', 'danger')
return False
elif self.set_contest.data: elif self.set_contest.data:
contest_place = db.get_place_by_code(self.contest_place.data) contest_place = self.contest_place.place
if not contest_place:
flash("Nepovedlo se najít "+round.get_level().name_accusative("zadaný", "zadanou", "zadané"), 'danger')
return False
# Contest hledáme vždy v master kole, abychom náhodou nepřesunuli účastníky do soutěže v podkole # Contest hledáme vždy v master kole, abychom náhodou nepřesunuli účastníky do soutěže v podkole
contest = sess.query(db.Contest).filter_by(round_id=round.master_round_id, place_id=contest_place.place_id).one_or_none() contest = sess.query(db.Contest).filter_by(round_id=round.master_round_id, place_id=contest_place.place_id).one_or_none()
if not contest: if not contest:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment