Commit 543756ea authored by Hinrikus Wolf's avatar Hinrikus Wolf

add support for naming speaker

parent 37475dc6
......@@ -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.")])
......
......@@ -203,6 +203,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()
......
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