Пример #1
0
def index(request, page=1):
    page = int(page)
    if page < 1:
        page = 1
    page_size = 10
    total = Post.count()
    post_list = Post.get_list(page, page_size)

    pager = Pager(total, page_size, page, page_list_num=8)

    return render_to_response("index.html", {"post_list": post_list, "pager": pager}, RequestContext(request))
Пример #2
0
def post_list(request):
    page = int(request.GET.get('page', 1))
    if page < 1:
        page = 1
    page_size = 15
    total = Post.count()
    post_list = Post.get_list(page, page_size)

    pager = Pager(total, page_size, page, page_list_num = 10)

    return render_to_response('admin/post_list.html', {
            'post_list': post_list,
            'pager': pager,
        }, RequestContext(request))