django分页

page_count = 1
current_page = int(request.GET.get('p',1))
course1 = Course.objects.all().order_by('-sum_people')
pag = Paginator(course1,page_count)
course = pag.get_page(current_page)
total_page = len(course1)
<link rel="stylesheet" href="{% static 'css/jquery.pagination.css' %}">
<script type="text/javascript" src="{% static 'js/jquery-1.12.4.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/jquery.pagination.min.js' %}"></script> <div id="pagination" class="page" style="text-align: center;"></div> <script>
// 调用父页面的方法改变菜单指示
// window.parent.fnChangeMenu(2); $(function(){
$("#pagination").pagination({
currentPage: {{ current_page }},
totalPage: {{ total_page }},
callback: function(current) {
{#alert('ok!');#}
window.location.href = '/home_page/?p='+current
}
});
});
</script>
上一篇:OutputCache祥解


下一篇:JAVA多线程实现的四种方式(转自https://www.cnblogs.com/felixzh/p/6036074.html)