def add_talk_seminar(seminarid):
    sem = Seminar.query.get(seminarid)

    if sem is None:
        flash("No Such Seminar", "Error")
        return default()

    if request.method == 'POST': 
        if sem.Organizer_id == current_user.id or current_user.has_role('admin'): 
            talk = Talk()
            talk.topic = request.form.get("topic")
            talk.abstract = request.form.get("abstract")
            talk.date_of = datetime.strptime(request.form.get("date_of"), '%m/%d/%Y %I:%M %p')
            talk.seminar_id = seminarid
            talk.speaker = request.form.get("speaker")
            talk.speaker_info = request.form.get("speaker_info") 
            talk.location = request.form.get("location")
            base_app.db.session.add(talk)
            base_app.db.session.commit()
            flash("Talk added for seminar %s" % sem.title, "Success")
            return default()
        else:
            flash("Insufficient Permissions", "Error")
            return default()

    return render_template('add_talk.html', seminar=sem)
def create_talk():
	name = request.form['name']
	speaker = request.form['speaker']
	talk = Talk(votes=0, name=name, speaker=speaker)
	talk.name = name
	talk.speaker = speaker
	talk.votes = 0
	talk.put()
	return redirect(url_for('create_talk_form'))