In my application, I have various articles users can create with a category field that I want to serve as a tagging system. On the left hand side of my application, I'd like these categories to be listed so users can filter by interest but I'm currently unable to get it working. The error I'm getting is listed below:
Using the URLconf defined in bitpoll.urls, Django tried these URL patterns, in this order:
^articles/ ^all/$ ^articles/ ^get/(?P<article_id>\d+)/$ ^articles/ ^category/(?P<article_category>\d+)/$ ^admin/The current URL, articles/category/electronics, didn't match any of these.
My code can be found on GitHub here and the location of the error is in /article/urls.py.
Clicking on a specific article in /article/templates/articles.html works just fine but it doesn't work for my categories and it seems to me like they're setup the exact same way.
In your articles route the regex is looking for digits. Correct the regex to match any characters that can occur in your article_category field. For example, the \w matches any alphanumeric character and the underscore.
^articles/ ^category/(?P<article_category>\w+)/$
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With