def edit_store(store_id): store = Store.get_by_id(store_id) if request.method == 'POST': name = request.form['name'] url_prefix = request.form['url_prefix'] tag_name = request.form['tag_name'] query = json.loads(request.form['query']) store.name = name store.url_prefix = url_prefix store.tag_name = tag_name store.query = query store.save_to_mongo() return redirect(url_for('.index')) return render_template('stores/edit_store.html', store=store)
def delete_store(store_id): Store.get_by_id(store_id).remove_from_mongo() return redirect(url_for('.index'))