我尝试使用Django分页无穷无尽,它完美地运行了Twitter和滚动。它不适用于Digg风格。不幸的是我在我的应用程序中需要Digg Style。这是我的代码:
View.py
from endless_pagination.decorators import page_template
@page_template('template_page.html')
def my_view(request, template='template.html', extra_context=None, ord=3):
# some code to setting variable to pass to the template.html
var = 2
var = 1
my_data = my_data.objects.all()
context = {
'my_data':my_data,
'var1': var1,
'var2': var2,
'my_data' : my_data,
}
if extra_context is not None:
context.update(extra_context)
return render_to_response(template, context,
context_instance=RequestContext(request))
template.html
<table>
<tbody>
<div class="endless_page_template">
{% include page_template %}
</div>
</tbody>
</table>
<script src="/static/assets/scripts/endless_pagination/js/endless-pagination.js"></script>
<script>
$(document).ready(function() {
$.endlessPaginate();
});
</script>
template_page.html
{% load endless %}
{% paginate my_data %}
{% for data in my_data %}
...
{% endfor %}
{% get_pages %}
{% if pages.paginated %}
{{ pages }}
{% endif %}
如果我点击页码,没有任何反应(没有页面刷新,没有ajax调用等)。问题出在哪儿?非常感谢。在控制台中没有任何事情发生