class HomePage(ListView):
model = Feature
template_name = 'app_calculator/index.html'
context_object_name = 'categories'
def get_queryset(self):
return Category.objects.prefetch_related().filter(feature__type=self.kwargs['slug'])
def get_context_data(self, *, object_list=None, **kwargs):
context = super().get_context_data(**kwargs)
context['title'] = Type.objects.get(slug=self.kwargs['slug'])
# context['categories'] = Category.objects.prefetch_related().filter(feature__type=self.kwargs['slug'])
return context
Вот сайт с которого я беру пример
https://estimatemyapp.com/