added pagination macro

This commit is contained in:
Daniel Tsvetkov 2020-07-13 10:38:29 +02:00
parent fc28212ce0
commit 6b2d3fa439
2 changed files with 16 additions and 0 deletions

View File

@ -271,6 +271,7 @@ db_migrate() {
db_upgrade() {
shift
source venv/bin/activate
mkdir -p data
python manager.py db upgrade
}

View File

@ -0,0 +1,15 @@
{% macro render_pagination(pagination, endpoint) %}
<div class="pagination">
{%- for page in pagination.iter_pages() %}
{% if page %}
{% if page != pagination.page %}
<a href="{{ url_for(endpoint, page=page) }}">{{ page }}</a>
{% else %}
<strong>{{ page }}</strong>
{% endif %}
{% else %}
<span class="ellipsis"></span>
{% endif %}
{%- endfor %}
</div>
{% endmacro %}