0

代码不清楚,想在django模板中使用分页。

views.py 中有什么?什么在设置中,py ??

模板是:-

<div id="contentwrapper">
                <div class="main_content">
                        <div class="row-fluid">
                <div class="span12">
                      <h3 class="heading">Application View</h3>
                        <div class="row-fluid">

                            <table class="table table-striped table-bordered mediaTable">
                                <thead><tr><th>App Id</th><th>Job Title</th><th>oDesk Id</th><th>Client Spent</th><th>Job Type</th><th>Notes</th><th colspan=2>Action</th></tr>
</thead>
<tbody>
{% for i in getvalue %}
 <tr>

<td>{{ i.app_id }}</td>
<td>{{ i.job_title }}</td>
<td>{{ i.odesk_id }}</td>
<td>{{ i.client_spent }}</td>
<td>{{ i.job_type }}</td>
<td>{{ i.notes_type }}</td>
<td><a href="/interview/?id={{i.app_id}}&oid={{i.odesk_id}}" title="Interview"><i class="splashy-document_letter_okay"></i></a></td>

<td><a href="/del/?id={{i.app_id}}" title="Remove"><i class="splashy-document_letter_remove"></i></a></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
4

2 回答 2

0

您可以使用 django 的默认分页选项外观...,

https://docs.djangoproject.com/en/dev/topics/pagination/

于 2013-09-13T05:24:12.943 回答
0

使用 django-endless-pagination 在不到 5 分钟的时间内启动并运行分页:

http://django-endless-pagination.readthedocs.org/en/latest/

pip install django-endless-pagination

添加endless-pagination已安装的应用程序。

最后,在您的模板上执行以下操作:

{% load endless %}

{% paginate entries %}
{% for entry in entries %}
    {# your code to show the entry #}
{% endfor %}
{% show_pages %}
于 2013-09-13T05:38:03.923 回答