From 327bd4cfc599dbeddd501afd5221a1d2ff7eee08 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 8 Nov 2014 19:15:35 -0600 Subject: Paginate the todolist listing page Signed-off-by: Dan McGee --- todolists/views.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'todolists/views.py') 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 @@ 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 -- cgit v1.2.3-54-g00ecf