''Product' matching query does not exist

this is the views code, the item is in the database but it still brings DoesNotExist, i have also tried get_object_or_404 im trying this url http://127.0.0.1:8000/store/shirts/mavi-jeans/

def product_detail(request, category_slug, product_slug):
try:
    single_product = Product.objects.get(category__slug=category_slug, slug=product_slug)
except Exception as e:
    raise e
    
context = {'single_product':single_product}
return render(request, 'store/product_detail.html', context)


urlpatterns = [
path('', views.store, name='store'),
path('<slug:category_slug>/', views.store, name='products_by_category'),
path('<slug:category_slug>/<slug:product_slug>/', views.product_detail, name='product_detail'),

]



Solution 1:[1]

i just figured out i was not paying attention to the url enough, the 'mavi-jeans' is not in the shirt category the correct url is
http://127.0.0.1:8000/store/jeans/mavi-jeans/

THE CODE IS CORRECT

thank you all for your contributions

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 victorTobi