def index(request):
film_list = films_script.Post.objects.all()
paginator = Paginator(film_list, 4) # Show 25 contacts per page
page = request.GET.get('page')
try:
films = paginator.page(page)
except PageNotAnInteger:
# If page is not an integer, deliver first page.
films = paginator.page(1)
except EmptyPage:
# If page is out of range (e.g. 9999), deliver last page of results.
films = paginator.page(paginator.num_pages)
context = {
'films': films
}
return render(request, 'index.html', context)
def index(request):
film_list = films_script.Post.objects.all()
paginator = Paginator(film_list, 4) # Show 25 contacts per page
page = request.GET.get('page')
try:
films = paginator.page(page)
except PageNotAnInteger:
# If page is not an integer, deliver first page.
films = paginator.page(1)
except EmptyPage:
# If page is out of range (e.g. 9999), deliver last page of results.
films = paginator.page(paginator.num_pages)
context = {
'films': films
}
return render(request, 'index.html', context)