Skip to content
Advertisement

List View is not working but get_context_data() works

I have a ListView but when I call it only the get_context_data method works (the news and category model, not the product) when I try to display the information of the models in the templates.

view:

JavaScript

There is also this piece of code: context = super().get_context_data(**kwargs) If it’s written before: categories = Category.objects.all() The Product model is show but not the others.

base.html

JavaScript

home.html

JavaScript

categories.html

JavaScript

Advertisement

Answer

The problem is that you override context, but you need to update it. Try this:

JavaScript
Advertisement