forked from rDrama/rDrama
1
0
Fork 0

use new pagination system

master
Aevann 2023-05-05 03:50:36 +03:00
parent 36612a3045
commit a0469edfc7
2 changed files with 3 additions and 20 deletions

View File

@ -49,6 +49,7 @@ def dm_images(v):
with open(f"{LOG_DIRECTORY}/dm_images.log", "r", encoding="utf-8") as f:
items=f.read().split("\n")[:-1]
next_exists = len(items)
items = [x.split(", ") for x in items]
items.reverse()
@ -56,9 +57,8 @@ def dm_images(v):
except: page = 1
firstrange = PAGE_SIZE * (page - 1)
secondrange = firstrange + PAGE_SIZE + 1
secondrange = firstrange + PAGE_SIZE
items = items[firstrange:secondrange]
next_exists = (len(items) > PAGE_SIZE)
return render_template("admin/dm_images.html", v=v, items=items, next_exists=next_exists, page=page)

View File

@ -53,22 +53,5 @@
{% endblock %}
{% block pagenav %}
<nav>
<ul class="pagination pagination-sm py-3 pl-3 mb-0">
{% if page>1 %}
<li class="page-item">
<small><a class="page-link" href="?page={{page-1}}" tabindex="-1">Prev</a></small>
</li>
{% else %}
<li class="page-item disabled"><span class="page-link">Prev</span></li>
{% endif %}
{% if next_exists %}
<li class="page-item">
<small><a class="page-link" href="?page={{page+1}}">Next</a></small>
</li>
{% else %}
<li class="page-item disabled"><span class="page-link">Next</span></li>
{% endif %}
</ul>
</nav>
{% include "pagination.html" %}
{% endblock %}