Exemplo n.º 1
0
def index():
    book_count = BookInfo.objects.count()
    books = BookInfo.objects.limit(page_limit)
    # user = User.objects.get(id=current_user.id)
    users = User.objects
    book_amount = amount_fake_aggregation.count_all()
    book_out = Delivery.objects(returned__ne=True).count()
    return render_template('index.html', books=books, user=current_user, all_books=books, users=users,
                           page=(book_count/page_limit)+2, current_page=1, book_amount=book_amount, book_out=book_out)
Exemplo n.º 2
0
def index_page(n):
    # TODO: 分页实现的优化
    skip = (int(n)-1) * page_limit
    book_count = BookInfo.objects.count()
    books = BookInfo.objects.skip(skip).limit(page_limit)
    users = User.objects
    book_amount = amount_fake_aggregation.count_all()
    book_out = Delivery.objects(returned__ne=True).count()
    return render_template('index.html', books=books, user=current_user, all_books=books, users=users,
                           page=(book_count/page_limit)+2, current_page=int(n),
                           book_amount=book_amount, book_out=book_out)