def add(): form = ExtensionForm() if request.method == 'POST' and form.validate_on_submit(): extensions.add(g.url_rest, form) flash('Extension added') return redirect(url_for('extensions.list')) return render_template('extension_add.html', form=form)
def edit(id): my_extensions = extensions.show(g.url_rest + "/" + id) form = ExtensionForm.from_json(my_extensions) if form.is_submitted(): extensions.edit(g.url_rest + "/" + id, ExtensionForm(obj=extensions)) return redirect(url_for("extensions.list")) return render_template('extension_edit.html', extensions=my_extensions, form=form)