def destroy(id): found_book = Book.find(id) Book.book_list.remove(found_book) return redirect(url_for('index'))
def update(id): found_book = Book.find(id) found_book.title = request.form['title'] found_book.author = request.form['author'] return redirect(url_for('index'))
def show(id): return render_template('show.html', book = Book.find(id))
def edit(id): return render_template('edit.html', book = Book.find(id))
def books(): response.set_header('Content-Type', 'application/json') prefix = get_prefix(request) bks = [bk.to_json(prefix=prefix) for bk in Book.find()] return '[' + ',\n'.join(bks) + ']'