示例#1
0
def destroy(id):
    found_book = Book.find(id)
    Book.book_list.remove(found_book)
    return redirect(url_for('index'))
示例#2
0
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'))
示例#3
0
def show(id):
    return render_template('show.html', book = Book.find(id))
示例#4
0
def edit(id):
    return render_template('edit.html', book = Book.find(id))
示例#5
0
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) + ']'