forked from rDrama/rDrama
use new pagination system in /@<username>/blockers
parent
bf85f9d4fb
commit
af74a752ad
|
@ -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)
|
||||
|
||||
|
|
|
@ -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 %}
|
||||
|
|
Loading…
Reference in New Issue