From 076345298ef42a054437f90aaf8fd96842045881 2015-03-04 20:30:54 From: Bradley M. Kuhn Date: 2015-03-04 20:30:54 Subject: [PATCH] Allow additional arguments to listing() call. The urls setup of old gave us various arguments at call time for custom_index(), and some where useful. Hopefully, listing() can support the same type of system, over time, once adapted. Here's an attempt to get it started, first by supporting paginate_by. --- diff --git a/www/conservancy/apps/news/views.py b/www/conservancy/apps/news/views.py index 70a7c76dd229195d68e2e895246202912861445c..de2e45cf65bc1a5453ba973a5498f5983ec40e24 100644 --- a/www/conservancy/apps/news/views.py +++ b/www/conservancy/apps/news/views.py @@ -18,7 +18,7 @@ class NewsListView(ListView): context.update(self.extra_context) return context -def listing(request): +def listing(request, *args, **kwargs): news_queryset = PressRelease.objects.all() # if (not kwargs.has_key('allow_future')) or not kwargs['allow_future']: @@ -27,7 +27,8 @@ def listing(request): date_list = news.dates(kwargs['date_field'], 'year') - paginator = Paginator(news_queryset, 6) # Show 6 news items per page + paginate_by = kwargs.get('paginate_by', 6) # Show 6 news items per page, by default + paginator = Paginator(news_queryset, paginate_by) page = request.GET.get('page') try: