I am trying to pass a parameter to a url before my include statement. I think my problem should be similar to this one, but I can't figure out why mine isn't working. I get the error NoReverseMatch at /womens/ Reverse for 'shampoo' with arguments '('womens',)' not found. 1 pattern(s) tried: ['(?P<gender>womens|mens)/items/shampoo/$']
*config.urls*
urlpatterns = [
re_path(r'(?P<gender>womens|mens)/items/$, include('items.urls')),
...
]
*items.urls*
urlpatterns = [
path('shampoo', views.shampoo, name='shampoo'),
path('soap', views.soap, name='soap'),
...
]
{% url 'items:shampoo' gender='male' %}
I expect to get male/items/shampoo, but it doesn't work. Despite this, I can still manually go to male/items/shampoo.