diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-04-15 22:02:30 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-04-15 22:02:30 -0400 |
commit | 2ea4e6f4d5245dd5e43c90d54635477c6e7dd6a7 (patch) | |
tree | d0994cde414fffd3389d036f5a043327aae3af39 /todolists | |
parent | 05430050147c87818c08373e9930756da4d6b5ac (diff) | |
parent | e5fc7cd53f6082f2911bc6c8cf8ea4f4ca4addc8 (diff) |
Merge tag 'release_2014-11-08.2' into archweb-generic
Todolist pagination and sitemap, news sitemap
Diffstat (limited to 'todolists')
-rw-r--r-- | todolists/urls.py | 6 | ||||
-rw-r--r-- | todolists/views.py | 13 |
2 files changed, 11 insertions, 8 deletions
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 cdbfa702..db6f20f0 100644 --- a/todolists/views.py +++ b/todolists/views.py @@ -8,7 +8,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 @@ -92,10 +92,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 |