[Answer]-Unexpected URL concatenation

1👍

The menu links in your template may be pointing to “electronics/” and “books/” vs “/electronics” and “/books.” To conform with DRY, I recommend naming your url patterns and using the {% url %} template tag to load the correct url route.

For example:

url(r'^(?P<cat>[^/]+/$)', 'reviews.views.category', name='category'),

And in your template:

{% url 'category' 'books' %}

Which will return the correct ‘/books’ url route.

Leave a comment