|
@ -336,6 +336,17 @@ def edit_stack_by_id(id): |
|
|
return redirect(url_for('show_stack_by_id', id=id)) |
|
|
return redirect(url_for('show_stack_by_id', id=id)) |
|
|
return render_template('edit_stack_detail.html', stack=stack, form=form) |
|
|
return render_template('edit_stack_detail.html', stack=stack, form=form) |
|
|
|
|
|
|
|
|
|
|
|
@app.route('/stacks/<int:stackid>/remove/<int:bookid>', methods=['POST', 'GET']) |
|
|
|
|
|
def remove_from_stack(bookid, stackid): |
|
|
|
|
|
book = Book.query.get(bookid) |
|
|
|
|
|
stack = Stack.query.get(stackid) |
|
|
|
|
|
if book not in stack.books: |
|
|
|
|
|
return render_template('show_book_detail.html', book=book) |
|
|
|
|
|
stack.books.remove(book) |
|
|
|
|
|
db.session.commit() |
|
|
|
|
|
return render_template('show_book_detail.html', book=book) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## search |
|
|
## search |
|
|
|
|
|
|
|
|
@app.route('/books', methods= ['POST','GET']) |
|
|
@app.route('/books', methods= ['POST','GET']) |
|
|