예제 #1
0
파일: views.py 프로젝트: gmist/3dhero.ru
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
예제 #2
0
파일: views.py 프로젝트: minimedj/3dhero.ru
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
예제 #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