显示来自object_list peewee的值

时间:2019-05-07 18:32:10

标签: python flask peewee

我正在尝试使用peewee模型对Flask应用中的结果进行分页,但是我无法显示循环中的价值

app.py

@app.route('/log/')
def log():
    asd = loguser.select().join(user).order_by(loguser.id.desc())
    return object_list( 'log.html',
        query=asd,
        context_variable='post_list',
        paginate_by=10)

log.html

{% extends 'basic.html' %}
{% block content %}
    {% for data in object_list %}
        <p>{{data.id}}</p>
    {% endfor %}
    {% include "includes/pagination.html" %}
{% endblock %}

pagination.html

{% if pagination.get_page_count() > 1 %}
<ul class="pager">
  {% if pagination.get_page() > 1 %}
    <li class="previous"><a href="./?{{ request.args|clean_querystring('page', page=pagination.get_page() - 1) }}">&laquo; Previous {{ pagination.get_page() - 1 }} / {{ pagination.get_page_count() }}</a></li>
  {% else %}
    <li class="previous disabled"><a href="#">&laquo; Previous</a></li>
  {% endif %}
  {% if pagination.get_page_count() > pagination.get_page() %}
    <li class="next"><a href="./?{{ request.args|clean_querystring('page', page=pagination.get_page() + 1) }}">Next {{ pagination.get_page() + 1 }} / {{ pagination.get_page_count() }} &raquo;</a></li>
  {% else %}
    <li class="next disabled"><a href="#">Next &raquo;</a></li>
  {% endif %}
</ul>
{% endif %}

我希望输出的是一些数据,我可以移到另一页

0 个答案:

没有答案