Paginates lists view

This commit is contained in:
Mouse Reeve
2021-01-31 17:34:06 -08:00
parent 6e0d258c97
commit d7c32cc314
3 changed files with 26 additions and 6 deletions

View File

@ -4,8 +4,7 @@
<header class="block">
<h1 class="title">Lists</h1>
</header>
{% if request.user.is_authenticated %}
{% if request.user.is_authenticated and not lists.has_previous %}
<section class="block content">
<header class="columns">
<div class="column">
@ -27,18 +26,26 @@
</form>
{% if request.user.list_set.exists %}
{% include 'lists/list_items.html' with lists=request.user.list_set.all %}
{% include 'lists/list_items.html' with lists=request.user.list_set.all|slice:4 %}
{% endif %}
{% if request.user.list_set.count > 4 %}
<a href="{{ request.user.local_path }}/lists">See all {{ request.user.list_set.count}} lists</a>
{% endif %}
</section>
{% endif %}
{% if lists.exists %}
{% if lists %}
<section class="block content">
<h2 class="title">Recent Lists</h2>
{% if request.user.list_set.exists %}
{% include 'lists/list_items.html' with lists=lists %}
{% endif %}
</section>
<div>
{% include 'snippets/pagination.html' with page=lists path=path %}
</div>
{% endif %}
{% endblock %}