Exemplo n.º 1
0
def event_create():
    form = forms.EventForm(flask.request.form)
    if flask.request.method == 'POST' and form.validate():
        event = models.Event(**forms.form_values(form))
        if models.can_commit(event):
            return flask.redirect(flask.url_for('event', event_id = event.id))
        flask.flash('Event name already exists')
    return flask.render_template('event_form.html', form = form)
Exemplo n.º 2
0
def user_register():
    form = forms.RegistrationForm(flask.request.form)
    if flask.request.method == 'POST' and form.validate():
        user = models.User(**forms.form_values(form))
        if models.can_commit(user):
            return flask.redirect(flask.url_for('index'))
        else:
            flask.flash('Profile already exists')
    return flask.render_template('generic_form.html', form = form)