Paginate followers/following pages
This commit is contained in:
parent
99efe6b290
commit
786cf4fb97
|
@ -29,4 +29,6 @@
|
||||||
<div>{% blocktrans with username=user.display_name %}{{ username }} has no followers{% endblocktrans %}</div>
|
<div>{% blocktrans with username=user.display_name %}{{ username }} has no followers{% endblocktrans %}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% include 'snippets/pagination.html' with page=followers path=request.path %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -29,4 +29,6 @@
|
||||||
<div>{% blocktrans with username=user|username %}{{ username }} isn't following any users{% endblocktrans %}</div>
|
<div>{% blocktrans with username=user|username %}{{ username }} isn't following any users{% endblocktrans %}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% include 'snippets/pagination.html' with page=following path=request.path %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -106,10 +106,11 @@ class Followers(View):
|
||||||
if is_api_request(request):
|
if is_api_request(request):
|
||||||
return ActivitypubResponse(user.to_followers_activity(**request.GET))
|
return ActivitypubResponse(user.to_followers_activity(**request.GET))
|
||||||
|
|
||||||
|
paginated = Paginator(user.followers.all(), PAGE_LENGTH)
|
||||||
data = {
|
data = {
|
||||||
"user": user,
|
"user": user,
|
||||||
"is_self": request.user.id == user.id,
|
"is_self": request.user.id == user.id,
|
||||||
"followers": user.followers.all(),
|
"followers": paginated.page(request.GET.get("page", 1)),
|
||||||
}
|
}
|
||||||
return TemplateResponse(request, "user/followers.html", data)
|
return TemplateResponse(request, "user/followers.html", data)
|
||||||
|
|
||||||
|
@ -131,10 +132,11 @@ class Following(View):
|
||||||
if is_api_request(request):
|
if is_api_request(request):
|
||||||
return ActivitypubResponse(user.to_following_activity(**request.GET))
|
return ActivitypubResponse(user.to_following_activity(**request.GET))
|
||||||
|
|
||||||
|
paginated = Paginator(user.followers.all(), PAGE_LENGTH)
|
||||||
data = {
|
data = {
|
||||||
"user": user,
|
"user": user,
|
||||||
"is_self": request.user.id == user.id,
|
"is_self": request.user.id == user.id,
|
||||||
"following": user.following.all(),
|
"following": paginated.page(request.GET.get("page", 1)),
|
||||||
}
|
}
|
||||||
return TemplateResponse(request, "user/following.html", data)
|
return TemplateResponse(request, "user/following.html", data)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue