Views.py
matching_product = Product.objects.filter(shop__shop_slug=single_slug)
return render(request, 'products/shop_products.html',{"part_ones":matching_product})
urls.py
path("<single_slug>",views.single_slug, name="single_slug")
shop_products
{% for shops in matching_product %}
shop.html (用于url)
<a href="{{shop.shop_slug}}"><strong>{{shop.shop_location}}</strong></a>
它没有显示任何产品
发布于 2020-04-10 21:35:24
Product.objects.filter(shop__shop_slug=single_slug) = matching_product
首先,调试上面的行。有什么结果吗?
https://stackoverflow.com/questions/61152252
复制