mirror of
http://git.carcosa.net/jmcbray/brutaldon.git
synced 2025-01-27 01:52:45 -05:00
Add paging for user pages
This commit is contained in:
parent
025a6f736d
commit
bdb6dc16fd
@ -100,5 +100,13 @@ Brutaldon - {{ user.acct }} timelime
|
||||
{% endif %}
|
||||
<hr class="is-hidden">
|
||||
{% endfor %}
|
||||
<nav class="pagination is-centered" role="navigation" aria-label="pagination">
|
||||
{% if prev %}
|
||||
<a class="pagination-next" href="{% url 'note_prev' prev.since_id %}">Newer</a>
|
||||
{% endif %}
|
||||
{% if next %}
|
||||
<a class="pagination-previous" href="{% url 'note_next' next.max_id %}">Older</a>
|
||||
{% endif %}
|
||||
</nav>
|
||||
|
||||
{% endblock %}
|
||||
|
@ -277,18 +277,33 @@ def thread(request, id):
|
||||
'fullbrutalism': fullbrutalism_p(request)})
|
||||
|
||||
def user(request, username):
|
||||
mastodon = get_mastodon(request)
|
||||
try:
|
||||
mastodon = get_mastodon(request)
|
||||
except NotLoggedInException:
|
||||
return redirect(about)
|
||||
try:
|
||||
user_dict = mastodon.account_search(username)[0]
|
||||
except IndexError:
|
||||
raise Http404("The user %s could not be found." % username)
|
||||
data = mastodon.account_statuses(user_dict.id)
|
||||
relationship = mastodon.account_relationships(user_dict.id)[0]
|
||||
return render(request, 'main/user.html',
|
||||
try:
|
||||
prev = data[0]._pagination_prev
|
||||
if len(mastodon.account_statuses(user_dict.id,
|
||||
since_id=prev['since_id'])) == 0:
|
||||
prev = None
|
||||
except IndexError:
|
||||
prev = None
|
||||
try:
|
||||
next = data[-1]._pagination_next
|
||||
except IndexError:
|
||||
next = None
|
||||
return render(request, 'main/user.html',
|
||||
{'toots': data, 'user': user_dict,
|
||||
'relationship': relationship,
|
||||
'own_username': request.session['user'].acct,
|
||||
'fullbrutalism': fullbrutalism_p(request)})
|
||||
'fullbrutalism': fullbrutalism_p(request),
|
||||
'prev': prev, 'next': next})
|
||||
|
||||
|
||||
@never_cache
|
||||
|
Loading…
x
Reference in New Issue
Block a user