def book_remove(book_id): b = Book.get(book_id) if not b: abort(404) if not b.is_public: abort(403) if current_user.has_book(b): current_user.books.remove(b) current_user.save() return redirect(url_for("main"))
def book_get(book_id): b = Book.get(book_id) if not b: abort(404) if not b.is_public: abort(403) if not current_user.has_book(b): current_user.books.append(b) current_user.save() return redirect(url_for("public"))