jrief/django-shop

django cannot find url for product and order if click "View on site" at admin panel

Closed this issue · 1 comments

If click "View on site" at admin panel then django cannot find url for product and order. It will work if add slash to:
1 - product.py (of myshop app)

# myshop/urls/product.py
url(r'^(?P<slug>[\w-]+)$', ProductRetrieveView.as_view(serializer_class=ProductDetailSerializer)), 
-> 
url(r'^(?P<slug>[\w-]+)/$', ProductRetrieveView.as_view(serializer_class=ProductDetailSerializer))

2 - order.py (of shop app)

# shop/urls/order.py
url(r'^(?P<pk>\d+)$', OrderView.as_view(many=False)), 
-> 
url(r'^(?P<pk>\d+)/$', OrderView.as_view(many=False)),
jrief commented

I personally prefer detail views without a final slash to indicate that they are leaves.
Just tried out with our product and order detail view and they both work fine.

How is your setting?