コード例 #1
0
ファイル: routes.py プロジェクト: samuelitwaru/tujari
def product():
    if request.method == "GET":
        page_number = request.args.get("page", 1, type=int)
        pages = Paginate(ProductDetails.read_products_details(ProductDetails),
                         page_number, 10)
        prev_url = url_for(
            "vendors.product",
            page=pages.previous_page) if pages.has_previous else None
        next_url = url_for("vendors.product",
                           page=pages.next_page) if pages.has_next else None

    return render_template('vendor/listed-products.html',
                           pages=pages,
                           next_url=next_url,
                           prev_url=prev_url)
コード例 #2
0
ファイル: routes.py プロジェクト: samuelitwaru/tujari
def home():
    form = LoginForm()
    # cart_items = AddToCart.read_customer_cart_items(AddToCart, current_user.id)
    if request.method == "GET":
        images = session.query(HomeSlideShowImages)\
        .order_by(HomeSlideShowImages.order).all()

        ordered_categories = Category.getHomeDisplayCategories(Category)
        page_number = request.args.get("page", 1, type=int)
        pages = Paginate(ProductDetails.read_products_details(ProductDetails),
                         page_number, 10)
        prev_url = url_for(
            "customers.home",
            page=pages.previous_page) if pages.has_previous else None
        next_url = url_for("customers.home",
                           page=pages.next_page) if pages.has_next else None
    return render_template('customer/index.html',
                           form=form,
                           pages=pages,
                           next_url=next_url,
                           prev_url=prev_url,
                           images=images,
                           enumerate=enumerate,
                           ordered_categories=ordered_categories)