[Answer]-Same URL Pattern, two different views?

1👍

You will need to differentiate based on the url pattern, and then simply move the more specific pattern first in you urls.py. The first pattern to match will be used.

That will lead you to something like:

url(r'^(?P<cat>[^/]+)/(?P<prod>[^/]+)/$', Product.as_view(), name='product')
url(r'^(?P<cat>.+)/$', Category.as_view(), name='category')
👤mjl

Leave a comment