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:
Brett Smith 2017-02-03 11:02:33 -05:00
parent 40133bb73b
commit 0160f03c25

View file

@ -21,12 +21,8 @@ def custom_index(request, queryset, *args, **kwargs):
year. year.
""" """
kwargs = kwargs.copy() extra_context = kwargs.get('extra_context', {}).copy()
kwargs['extra_context'] = kwargs.get('extra_context', {}).copy()
extra_context = kwargs['extra_context']
date_field = kwargs['date_field'] date_field = kwargs['date_field']
del kwargs['date_field']
if not kwargs.get('allow_future', False): if not kwargs.get('allow_future', False):
queryset = queryset.filter(**{'%s__lte' % date_field: datetime.now()}) 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') date_list = queryset.dates(date_field, 'year')
extra_context['date_list'] = date_list 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 paginate_by = kwargs.get('paginate_by', 6) # Show 6 news items per page, by default
paginator = Paginator(queryset, paginate_by) paginator = Paginator(queryset, paginate_by)
page = request.GET.get('page') page = request.GET.get('page')
try: try: