Reputation: 31
I want to override get_context_data with containing data from other model.
I have Detail View, and on that website page i want to display list with pagination.
I want to mixing detail view and also few list view, i want to make pagination available on detail page, and i want filtering with .filter() and **kwargs or manual kwargs.
I want inherit list view in detail view, i want to have inheritance of list view within detail view. I want it short.
I want make pagination config withing get_context_data with simple paginate_by = ... Is that possible?
Upvotes: 1
Views: 572
Reputation: 101
You need to do something like
def get_context_data(self, *args, **kwargs):
context = super(MyClass, self).get_context_data(*args, **kwargs)
context['MyList'] = QuerySet
return context
This adds whatever you want to the context and makes it available in the template.
Upvotes: 1