summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2014-11-08 19:15:35 -0600
committerDan McGee <dan@archlinux.org>2014-11-08 19:15:38 -0600
commit327bd4cfc599dbeddd501afd5221a1d2ff7eee08 (patch)
tree8b0266a85c78c5d50e220f45eedae4e642b8d13b
parent88a457f1c8ae057278f1a7cadb6c163183484019 (diff)
Paginate the todolist listing page
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--sitestatic/archweb.css11
-rw-r--r--templates/todolists/list.html7
-rw-r--r--todolists/urls.py6
-rw-r--r--todolists/views.py13
4 files changed, 28 insertions, 9 deletions
diff --git a/sitestatic/archweb.css b/sitestatic/archweb.css
index edabcfb7..cd46e4c0 100644
--- a/sitestatic/archweb.css
+++ b/sitestatic/archweb.css
@@ -655,6 +655,17 @@ div.news-article .article-info {
width: 75%;
}
+/* todolists: list */
+.todolist-nav {
+ float: right;
+ margin-top: -2.2em;
+}
+
+ .todolist-nav .prev,
+ .todolist-nav .next {
+ margin: 0 1em;
+ }
+
/* donate: donor list */
#donor-list ul {
width: 100%;
diff --git a/templates/todolists/list.html b/templates/todolists/list.html
index 7f0368de..983a49f0 100644
--- a/templates/todolists/list.html
+++ b/templates/todolists/list.html
@@ -16,7 +16,10 @@
<p>Todo lists are used by the developers when a rebuild of a set of
packages is needed. This is common when a library has a version bump,
during a toolchain rebuild, or a general cleanup of packages in the
- repositories. The progress can be tracked here.</p>
+ repositories. The progress can be tracked here, and completed todo lists
+ can be browsed as well.</p>
+
+ {% include "todolists/paginator.html" %}
<table id="dev-todo-lists" class="results todo-table">
<thead>
@@ -46,6 +49,8 @@
{% endfor %}
</tbody>
</table>
+
+ {% include "todolists/paginator.html" %}
</div>
{% endblock %}
diff --git a/todolists/urls.py b/todolists/urls.py
index 6617d7dd..ed065f50 100644
--- a/todolists/urls.py
+++ b/todolists/urls.py
@@ -1,11 +1,11 @@
from django.conf.urls import patterns
from django.contrib.auth.decorators import permission_required
-from .views import (view_redirect, view, todolist_list, add, edit, flag,
- list_pkgbases, DeleteTodolist)
+from .views import (view_redirect, view, add, edit, flag,
+ list_pkgbases, DeleteTodolist, TodolistListView)
urlpatterns = patterns('',
- (r'^$', todolist_list),
+ (r'^$', TodolistListView.as_view(), {}, 'todolist-list'),
# old todolists URLs, permanent redirect view so we don't break all links
(r'^(?P<old_id>\d+)/$', view_redirect),
diff --git a/todolists/views.py b/todolists/views.py
index c37c13f5..c781a562 100644
--- a/todolists/views.py
+++ b/todolists/views.py
@@ -7,7 +7,7 @@ from django.shortcuts import (get_list_or_404, get_object_or_404,
redirect, render)
from django.db import transaction
from django.views.decorators.cache import never_cache
-from django.views.generic import DeleteView
+from django.views.generic import DeleteView, ListView
from django.template import Context, loader
from django.utils.timezone import now
@@ -91,10 +91,13 @@ def list_pkgbases(request, slug, svn_root):
return HttpResponse('\n'.join(pkgbases), content_type='text/plain')
-def todolist_list(request):
- incomplete_only = request.user.is_anonymous()
- lists = get_annotated_todolists(incomplete_only)
- return render(request, 'todolists/list.html', {'lists': lists})
+class TodolistListView(ListView):
+ context_object_name = "lists"
+ template_name = "todolists/list.html"
+ paginate_by = 50
+
+ def get_queryset(self):
+ return get_annotated_todolists()
@never_cache