Can't build the correct urls, where I took a wrong turn?

mapping includes = patterns(",
 url(r'^([\D\-]+)/$', views.category),
 url(r'^[\w\-]+/(?P<slug>[\w\-]+)/$', views.product_page),

def category(request, slug):
 slug = slug.split('/')[-1]
 requested_category = get_object_or_404(Category, slug=slug)

def product_page(request, slug):
 item = get_object_or_404(Product, slug=slug)

Now as you can see the url categories from the product url I know very strange, in the category can't be numbers (may in fact), and the goods definitely the figure is.
url categories up to three levels:
So the question is, where I took a wrong turn and how to get to the light?
July 9th 19 at 14:00
3 answers
July 9th 19 at 14:02
url(r'^new/(?P[\w-]+)$', name="new"),
If you one sentence I threw at once you understand, out of your option the correct.
If you meant to add the url a distinctive word or is there a set of characters. - shani commented on July 9th 19 at 14:05
July 9th 19 at 14:04
0. To abandon this style of URLs
1. Two level Каталог1/Товар1
2. Make prefix Catalogazione-каталога1/Tovarnaya-товара1
3. To make the suffix the name каталога1_каталог/name-товара1_товар
4. To create a CNC, but do not care about slug and focus on id
July 9th 19 at 14:06
Once solved this problem, but solution through and not come up.
In the mapping includes I have something like url(r'^catalog/.*\/$', catalog_view)
And in the view I did path = re.split('/', PATH_INFO).
Next, the logic was this:
1) made a request to the goods for path[-1], a result was filtered from the remaining parts of the path.
2) if nothing is found, it is assumed that we have before us the category and perform the appropriate action.
3) if that does not work, the 404.

Find more questions by tags DjangoPython