Django无止境分页twitter风格的分页不起作用
我正在为我的项目使用。但它并没有像预期的那样发挥作用。当我将代码更改为Django无止境分页twitter风格的分页不起作用,django,pagination,django-templates,django-endless-pagination,Django,Pagination,Django Templates,Django Endless Pagination,我正在为我的项目使用。但它并没有像预期的那样发挥作用。当我将代码更改为onscroll模式时,它既不显示show more,也不起作用 <script>$.endlessPaginate({paginateOnScroll: true});</script> views.py: @page_template('snapgroups.html') # just add this decorator def snaps( request, template
onscroll
模式时,它既不显示show more
,也不起作用
<script>$.endlessPaginate({paginateOnScroll: true});</script>
views.py:
@page_template('snapgroups.html') # just add this decorator
def snaps(
request, template='snaps.html', extra_context=None):
context = {
'snapgroup': SnapGroup.objects.all(),
}
if extra_context is not None:
context.update(extra_context)
return render_to_response(
template, context, context_instance=RequestContext(request))
snaps.html:
{% if snapgroup.count > 0 %}
<div class="endless_page_template">
{% include page_template %}
</div>
{% block js %}
{{ block.super }}
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="{{ STATIC_URL }}endless_pagination/js/endless-pagination.js"></script>
<script>$.endlessPaginate();</script>
{% endblock %}
{% else %}
<li><p>No SNAPGROUP yet!</p></li>
<span class="clear_both"></span>
{% endif %}
{%if snapgroup.count>0%}
{%include页面\模板%}
{%block js%}
{{block.super}}
$.endlessPaginate();
{%endblock%}
{%else%}
还没有团队
{%endif%}
snapgroups.html:
{% load endless %}
{% paginate snapgroup %}
{% for sg in snapgroup %}
<h4 id="combination" class="snap_date">{{sg.date|date:'l'}}, {{sg.date}}</h4>
<ul>
{% for snap in sg.snap_set.all %}
<li><a href="{{MEDIA_URL}}{{snap.image}}" data-imagelightbox="f"><img src="{{MEDIA_URL}}{{snap.image}}" alt="{{snap.caption}}" /></a></li>
{% endfor %}
<span class="clear_both"></span>
</ul>
{% endfor %}
{% show_more %}
{%load%}
{%paginate snapgroup%}
{snapgroup%中sg的%s}
{{sg.date}日期:'l'},{{{sg.date}
{管理单元sg.snap_set.all%}
{%endfor%}
{%endfor%}
{%show_more%}
这样就解决了我的问题。希望这能帮助其他人
{% load endless %}
{% paginate snapgroup %}
{% for sg in snapgroup %}
<h4 id="combination" class="snap_date">{{sg.date|date:'l'}}, {{sg.date}}</h4>
<ul>
{% for snap in sg.snap_set.all %}
<li><a href="{{MEDIA_URL}}{{snap.image}}" data-imagelightbox="f"><img src="{{MEDIA_URL}}{{snap.image}}" alt="{{snap.caption}}" /></a></li>
{% endfor %}
<span class="clear_both"></span>
</ul>
{% endfor %}
{% show_more %}