def create_book(title, author, pages, publish_date, publisher): book = Book() book.title = title book.author.append(author) book.pages = pages if publish_date: book.publish_date = publish_date book.publisher = publisher book.save() return book
def book_add_subscriber(bk, subscriber, start, end): book = Book(bk) borrow = Borrow(subscriber=subscriber, start=start, end=end) book.borrowing_history.append(borrow) book.save() return book