示例#1
0
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
示例#2
0
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