reloads page after successful form transmition in routes

This commit is contained in:
Raphael Maenle 2020-07-25 23:44:49 +02:00
parent 5ec5ba488d
commit c3dcccb479

View File

@ -109,9 +109,12 @@ def calendar():
calendar = db.session.query(Calendar).filter(Calendar.calendar_id==request.form.get("calendar")).first()
db.session.delete(calendar)
db.session.commit()
return flask.redirect(url_for('calendar'))
elif form.validate_on_submit():
ical.icalToCalendarDb(form.iCalURL.data, form.calName.data, current_user)
return flask.redirect(url_for('calendar'))
# otherwise it is a javascript POST
else:
@ -140,7 +143,6 @@ def calendar():
current_user.updateCalendar(calId, toggle=toggle)
# toggle specific calendar of user
return 'OK'
return flask.render_template('calendar.html', calendars=calendars, form=form)