Answer the question
In order to leave comments, you need to log in
How to arrange routing in django?
Greetings!
How to organize routing in Django?
There is a table with categories (id, name, parent_id, slug) and a table with pages (id, name, category_id, slug).
Categories have an arbitrary level of nesting. When forming a link, something like this is obtained: site.ru/category/category-lvl-1/category-lvl2/some-page
Actions:
Answer the question
In order to leave comments, you need to log in
Although somewhat cheating, but an extremely simple solution:
urlpatterns = [
url(r'^(?P<slug>[-\w/]+)/details/$', ProductDetail.as_view(), name='product'),
url(r'^(?P<slug>[-\w/]+)/$', ProductList.as_view(), name='category'),
]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question