Commit 601276b4 authored by Robin Sonnabend's avatar Robin Sonnabend

Merge branch 'master' of git.fsmpi.rwth-aachen.de:redl/redeleitsystem

parents d04544c2 67562611
......@@ -28,8 +28,9 @@ class AddStatementForm(Form):
class AddNameToSpeaker(Form):
speaker_name = StringField("Speaker", validators=[InputRequired("Entering the speaker is required.")])
speaker_id = HiddenField("Speaker_Id", validators=[NumberRange(min=0, message=None),InputRequired("ID must be a positve Integer.")])
event = HiddenField("Event")
number = HiddenField("Speaker_id", validators=[NumberRange(min=0, message=None),InputRequired("ID must be a positve Integer.")])
topic_id = HiddenField("Topic_id")
event_id = HiddenField("Event_id")
class NewEventForm(Form):
name = StringField("Name", validators=[InputRequired("Entering the name is required.")])
......
......@@ -204,6 +204,30 @@ def topic():
return render_layout("admin_topic_index.html", topics=topics)
@admin.route("/speaker/rename", methods=["GET", "POST"])
@login_required
@admin_permission.require()
def rename():
#speaker = Speaker.query.filter_by(number=number,event).first()
#if speaker is not None:
form = AddNameToSpeaker(obj=speaker)
speaker = Speaker.query.filter_by(number=form.number.data, event_id=form.event_id.data).first()
if speaker is not None:
if form.validate_on_submit():
speaker.name = form.speaker_name.data
db.session.commit()
return redirect(url_for(".topic_show",id=form.topic_id.data))
else:
return redirect(url_for(".index"))
@admin.route("/statement/")
@login_required
@admin_permission.require()
......
......@@ -12,7 +12,7 @@ def render_layout(template, **kwargs):
def speaker_by_name_or_number(name_or_number, event_id):
if name_or_number.isnumeric():
number = int(name_or_number)
speaker = Speaker.query.filter_by(number=number).first()
speaker = Speaker.query.filter_by(number=number, event_id=event_id).first()
if speaker is not None:
return speaker
else:
......@@ -22,7 +22,7 @@ def speaker_by_name_or_number(name_or_number, event_id):
return speaker
else:
name = name_or_number
speaker = Speaker.query.filter_by(name=name).first()
speaker = Speaker.query.filter_by(name=name, event_id=event_id).first()
if speaker is not None:
return speaker
else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment