Changeset - 0160f03c25ee
[Not reviewed]
0 1 0
Brett Smith (brett) - 7 years ago 2017-02-03 16:02:33
brett@sfconservancy.org
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.
1 file changed with 1 insertions and 10 deletions:
0 comments (0 inline, 0 general)
www/conservancy/apps/blog/views.py
Show inline comments
...
 
@@ -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:
0 comments (0 inline, 0 general)