我在我的项目中使用 django-el-pagination(Digg-style pagination),但结果似乎没有使用 AJAX。我需要在不刷新的情况下移动页面,但似乎 ajax 无法正常工作。
视图.py
@page_template('dmmactress/actress_dev_page.html')
def actress_dev(request, id, extra_context=None):
instance = get_object_or_404(ActressInfo_two, pk=id)
moviesinfo = ActressinfoMovielist_co.objects.filter(actressinfo_id=id).prefetch_related('movielist').order_by('movielist')
context = {
'actresses': instance,
'moviesinfo':moviesinfo,
}
if extra_context is not None:
context.update(extra_context)
return render(request, 'dmmactress/actress_dev.html', context)
女演员dev.html
........
<thead>
</thead>
<tbody id="entries" class="endless_page_template">
{% include page_template %}
</tbody>
........
女演员dev_page.html
{% load el_pagination_tags %}
{% paginate moviesinfos %}
{% for movieinfo in moviesinfo %}
{{ movieinfo.movielist.movie_number|upper }}
{% endfor %}
{% get_pages %}
{% if pages.paginated %}
{{ pages }}
{% endif %}
结果与不使用ajax的默认分页相同。此外,当我单击“页面”链接时,我会转到“/?page = 2”,其中包括刷新整个页面,这不是我想要做的。
在 Chrome 控制台上,页面重新加载时不会出现任何日志。(js文件已成功加载。)
我究竟做错了什么?