Exemple #1
0
def get_paginator(products, page, product_per_page=21):
    paginator = Paginator(products, product_per_page)
    try:
        products = paginator.page(page)
    except (EmptyPage, InvalidPage):
        products = paginator.page(paginator.num_pages)
    return products
Exemple #2
0
def get_paginator(products, page, product_per_page=21):
    paginator = Paginator(products, product_per_page)
    try:
        products = paginator.page(page)
    except (EmptyPage, InvalidPage):
        products = paginator.page(paginator.num_pages)
    return products
Exemple #3
0
def get_paginator(posts, page, posts_per_page=20):
    paginator = Paginator(posts, posts_per_page)
    try:
        posts = paginator.page(page)
    except (EmptyPage, InvalidPage):
        posts = paginator.page(paginator.num_pages)
    return posts