1👍
✅
get_context_data
method of ListView
builds context to pass to html template. In order to change that, do the following.
class IndexView(AppConfigMixin, generic.ListView):
model = Entry
template_name = 'faq/index.html'
def get_context_data(self, **kwargs):
context = super(MultipleObjectMixin, self).get_context_data(**kwargs)
values_to_pass = context['object_list'].values('url', 'count', 'start')
context['new_object_list'] = values_to_pass
return context
This will pass list of dicts to your html template like [{'url': 'some_url', ....}, {...}, ....]
Source:stackexchange.com