blog: Remove unnecessary kwargs manipulation from custom_index.
I don't know if this code is left over from previous versions or what, but it's not doing anything now. custom_index doesn't pass kwargs to anything else, so there's no need to fiddle with the dict so much.
This commit is contained in:
		
							parent
							
								
									40133bb73b
								
							
						
					
					
						commit
						0160f03c25
					
				
					 1 changed files with 1 additions and 10 deletions
				
			
		|  | @ -21,12 +21,8 @@ def custom_index(request, queryset, *args, **kwargs): | |||
|     year. | ||||
|     """ | ||||
| 
 | ||||
|     kwargs = kwargs.copy() | ||||
|     kwargs['extra_context'] = kwargs.get('extra_context', {}).copy() | ||||
|     extra_context = kwargs['extra_context'] | ||||
| 
 | ||||
|     extra_context = kwargs.get('extra_context', {}).copy() | ||||
|     date_field = kwargs['date_field'] | ||||
|     del kwargs['date_field'] | ||||
| 
 | ||||
|     if not kwargs.get('allow_future', False): | ||||
|         queryset = queryset.filter(**{'%s__lte' % date_field: datetime.now()}) | ||||
|  | @ -54,13 +50,8 @@ def custom_index(request, queryset, *args, **kwargs): | |||
|         date_list = queryset.dates(date_field, 'year') | ||||
|         extra_context['date_list'] = date_list | ||||
| 
 | ||||
|     # return object_list(request, queryset, *args, **kwargs) | ||||
|     kwargs['queryset'] = queryset | ||||
|     kwargs['extra_context'] = extra_context | ||||
| 
 | ||||
|     paginate_by = kwargs.get('paginate_by', 6)  # Show 6 news items per page, by default | ||||
|     paginator = Paginator(queryset, paginate_by) | ||||
| 
 | ||||
|     page = request.GET.get('page') | ||||
| 
 | ||||
|     try: | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Brett Smith
						Brett Smith