Пример #1
0
def view(book_ident):
    ident = int(book_ident)
    book = get_book(ident)
    return render_template("view.html",
                           book=book,
                           cart=get_cart(),
                           purchased=get_purchases())
Пример #2
0
def recommendations():
    recs = get_recommendations()  # sorted list of recs
    if len(recs) > 50:
        raise ValueError('get_recommendations returned list with > 50 books')

    return render_template("recommendations.html",
                           books=recs,
                           cart=get_cart(),
                           purchased=get_purchases())
Пример #3
0
def search():
    query = request.form['query']
    res = search_books(query)  # list of matching books
    if len(res) > 50:
        raise ValueError('search_books returned list with > 50 books')

    return render_template('search.html',
                           books=res,
                           query=query,
                           cart=get_cart(),
                           purchased=get_purchases())
Пример #4
0
def show_cart():
    return render_template('cart.html',
                           books=get_cart(),
                           cart=get_cart(),
                           purchased=get_purchases())
Пример #5
0
def home():
    return render_template('index.html',
                           books=get_book_dict(),
                           cart=get_cart(),
                           purchased=get_purchases())