Django template filter queryset
问题 I'm new in django. I has a django application where stores products categorized by 'X' and 'Y'. views.py ... class CartListView(ListView): template_name = 'checkout/list.html' context_object_name = 'product_list' def get_queryset(self): return Product.objects.filter(category__slug='X') | Product.objects.filter(category__slug='Y') def get_context_data(self, **kwargs): context = super(CartListView, self).get_context_data(**kwargs) context['minicurso'] = get_object_or_404(Category, slug='X')