Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_context_data(self, **kwargs):
- """
- Get the context for this view.
- """
- queryset = kwargs.pop('object_list', self.object_list)
- page_size = self.get_paginate_by(queryset)
- context_object_name = self.get_context_object_name(queryset)
- if page_size:
- paginator, page, queryset, is_paginated = self.paginate_queryset(queryset, page_size)
- context = {
- 'paginator': paginator,
- 'page_obj': page,
- 'is_paginated': is_paginated,
- 'object_list': queryset
- }
- else:
- context = {
- 'paginator': None,
- 'page_obj': None,
- 'is_paginated': False,
- 'object_list': queryset
- }
- if context_object_name is not None:
- context[context_object_name] = queryset
- context.update(kwargs)
- return super(MultipleObjectMixin, self).get_context_data(**context)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement