--------------------------------------------html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Title</title>
</head>
<body>
<ul>
{% for hero in page %}
<li>{{ hero.hname }}</li>
{% endfor %}
</ul>
<hr>
{% for index in page.paginator.page_range %}
{% if index == page.number %}
{{ index }}
{% else %}
<a href="/herolist/{{ index }}">{{ index }}</a>
{% endif %}
{% endfor %}
</body>
</html>
------------------------------views
def herolist(request,pindex):
list=HeroInfo.objects.all()
paginator=Paginator(list,5)
page=paginator.page(int(pindex))
context={'page':page}
return render(request,'booktest/herolist.html',context)