def details(event, user): form = forms.EventEditForm(flask.request.form, event) if flask.request.method == "POST" and form.validate(): form.populate_obj(event) event.save() audit_log.log( audit_log.Kind.EVENT_MODIFIED, description=f"{flask.g.user['name']} updated the event details.", event=event, user=user["user_id"], ) return flask.redirect( flask.url_for(flask.request.endpoint, event_slug=event.slug)) return flask.render_template("events/edit.html", event=event, form=form)
def add(): user = flask.g.user form = forms.EventEditForm(flask.request.form) if flask.request.method == "POST" and form.validate(): event = db.new_event() form.populate_obj(event) event.save() db.add_event_organizer(event, user) audit_log.log( audit_log.Kind.EVENT_MODIFIED, description=f"{flask.g.user['name']} created the event.", event=event, user=user["user_id"], ) return flask.redirect(flask.url_for(".numbers", event_slug=event.slug)) return flask.render_template("events/add.html", form=form)