def fetch_edit(fetch_id): fetch = models.Fetch.query.get(fetch_id) or flask.abort(404) form = forms.FetchForm(obj=fetch) if form.validate_on_submit(): form.populate_obj(fetch) db.session.commit() flask.flash('Fetch configuration updated') return flask.redirect( flask.url_for('.fetch_list', user_email=fetch.user.email)) return flask.render_template('fetch/edit.html', form=form, fetch=fetch)
def fetch_create(user_email): user_email = user_email or flask_login.current_user.email user = models.User.query.get(user_email) or flask.abort(404) form = forms.FetchForm() if form.validate_on_submit(): fetch = models.Fetch(user=user) form.populate_obj(fetch) db.session.add(fetch) db.session.commit() flask.flash('Fetch configuration created') return flask.redirect( flask.url_for('.fetch_list', user_email=user.email)) return flask.render_template('fetch/create.html', form=form)