forked from rDrama/rDrama
1
0
Fork 0

use new pagination system in /@<username>/blockers

master
Aevann 2023-05-05 08:57:02 +03:00
parent bf85f9d4fb
commit af74a752ad
2 changed files with 6 additions and 23 deletions

View File

@ -750,12 +750,12 @@ def blockers(v:User, username:str):
page = get_page()
users = g.db.query(UserBlock, User).join(UserBlock, UserBlock.target_id == u.id) \
.filter(UserBlock.user_id == User.id) \
.order_by(UserBlock.created_utc.desc()) \
.offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE + 1).all()
.filter(UserBlock.user_id == User.id)
next_exists = (len(users) > PAGE_SIZE)
users = users[:PAGE_SIZE]
next_exists = users.count()
users = users.order_by(UserBlock.created_utc.desc()) \
.offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE ).all()
return render_template("userpage/blockers.html", v=v, u=u, users=users, page=page, next_exists=next_exists)

View File

@ -24,22 +24,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 %}