diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2016-06-10 17:57:54 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2016-06-10 17:57:54 +0200 |
| commit | 052e4966c77ff4a47a99296ca1bbb39a8b11e8e9 (patch) | |
| tree | bed051ae7572ec1c465a170991360356990b08ef /templates | |
| parent | 02415a36adba08f228d77b860530e6b6dc7c53ec (diff) | |
| download | jokevote-052e4966c77ff4a47a99296ca1bbb39a8b11e8e9.tar.gz jokevote-052e4966c77ff4a47a99296ca1bbb39a8b11e8e9.zip | |
handle pagination in template
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/index.html | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/templates/index.html b/templates/index.html index db3cbda..6957d21 100644 --- a/templates/index.html +++ b/templates/index.html @@ -50,7 +50,7 @@ {% endif %} {% endwith %} <ul class="collection"> - {% for joke in jokes %} + {% for joke in jokes[currentpage*perpage:(currentpage+1)*perpage] %} <li class="collection-item row valign-wrapper"> <div class="col s4 m2 valign"> {% if not joke.deleted %} @@ -113,7 +113,7 @@ <div class="section center"> <ul class="pagination"> <li{% if currentpage==0 %} class="disabled"{% endif %}><a href="/page/{{ currentpage-1 }}"><i class="material-icons">chevron_left</i></a></li> - {% for page in pages %} + {% for page in range(jokes|length//perpage+1) %} <li{% if currentpage==loop.index0 %} class="active"{% endif %}><a href="/page/{{ loop.index0 }}">{{ loop.index }}</a></li> {% endfor %} <li{% if currentpage==loop.length-1 %} class="disabled"{% endif %}><a href="/page/{{ currentpage+1 }}"><i class="material-icons">chevron_right</i></a></li> |
