Dima Shvets
Dima Shvets

Reputation: 31

How in django can i insert list view within detail view using mixins

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

Answers (1)

Arnaud
Arnaud

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

Related Questions