where should pagination be shown on a page code example

Example 1: Using Paginator in a view function

from django.contrib.auth.models import User
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger

def index(request):
    user_list = User.objects.all()
    page = request.GET.get('page', 1)

    paginator = Paginator(user_list, 10)
    try:
        users = paginator.page(page)
    except PageNotAnInteger:
        users = paginator.page(1)
    except EmptyPage:
        users = paginator.page(paginator.num_pages)

    return render(request, 'core/user_list.html', { 'users': users }) here user is new parameter or variable...

Example 2: pagination

// input 
$page, $limit

// output
$offset = (($page - 1) * $limit);
$limit  = $limit;

Tags:

Css Example