Пример #1
0
def update_book(id):
    title    = request.form['title']
    genre = request.form['genre']
    publisher   = request.form['publisher']
    author  = author_repository.select(request.form['author_id'])
    book = Book(title, genre, publisher, author, id)
    print(book.author.full_name())
    book_repository.update(book)
    return redirect('/books')
Пример #2
0
def update_book(id):
    title = request.form['book-title']
    author_id = request.form['author']
    genre = request.form['genre']
    publisher = request.form['publisher']
    author = author_repository.select(author_id)
    book = Book(title, genre, publisher, author, id)
    book_repository.update(book)
    return redirect('/books')
Пример #3
0
def update_book(id):
    title = request.form['title']
    author_id = request.form['author_id']
    description = request.form['description']
    theme = request.form['theme']
    author = author_repository.select(author_id)
    book = Book(title, description, author, theme, id)
    book_repository.update(book)
    return redirect('/books')
Пример #4
0
def update_book(id):
    title = request.form['title']
    year = request.form['year']
    genre = request.form['genre']
    purchased = request.form['purchased']
    author_id = request.form['author_id']
    author = author_repository.select(author_id)
    book = Book(title, year, genre, purchased, author, id)
    book_repository.update(book)
    return redirect('/books')
Пример #5
0
def update_book(id):
    title = request.form["title"]
    genre = request.form["genre"]
    publisher = request.form["publisher"]
    author_id = request.form["author_id"]

    author = author_repository.select(author_id)
    book = Book(title, genre, publisher, author, id)
    book_repository.update(book)
    return redirect('/books')
Пример #6
0
def update_book(id):
    # grab the form data for book: title, genre, publisher
    title = request.form['title']
    genre = request.form['genre']
    publisher = request.form['publisher']

    # select the author from the repository
    author = author_repository.select(request.form['author_id'])

    # create a new Book object
    book = Book(title, genre, publisher, author)

    # save the Book object to database with the .update method
    book_repository.update(book)

    return redirect('/books')
def update_book():
    author = author_repository.select(request.form['author_id'])  
    book = Book(request.form['title'], request.form['genre'], request.form['publisher'], author, request.form['book_id'])
    book_repository.update(book)
    print(f"book id is {request.form['book_id']}")
    return redirect('/books')