Changeset - 076345298ef4
[Not reviewed]
0 1 0
Bradley Kuhn (bkuhn) - 9 years ago 2015-03-04 20:30:54
bkuhn@ebb.org
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.
1 file changed with 3 insertions and 2 deletions:
0 comments (0 inline, 0 general)
www/conservancy/apps/news/views.py
Show inline comments
...
 
@@ -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:
0 comments (0 inline, 0 general)