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.
This commit is contained in:
		
							parent
							
								
									317dd24206
								
							
						
					
					
						commit
						076345298e
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		|  | @ -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: | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue