jrief / django-shop

A Django based shop system
http://www.django-shop.org
BSD 3-Clause "New" or "Revised" License
32 stars 12 forks source link

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

Closed vivazzi closed 8 years ago

vivazzi commented 8 years ago

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 8 years ago

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?