Reputation: 55
In my App urls.py i have a urls conflict, every one is pointing to a different View, they have same syntax but one have a
urls.py
path('dashboard/categories/<str:category_name>', views.CategoryProductsView.as_view(), name='category_products')
path('dashboard/categories/add_category', views.AddCategoryView.as_view(), name='add_category'),
When i disable (comment) the first one the second url works fine , that's why i think that the problem comes from a url conflict
Upvotes: 0
Views: 105
Reputation: 374
The parameter that add_category expects is an integer? if so, specify it and put it before the string, possibly this way it will work.
path('dashboard/categories/<int:id>', views.AddCategoryView.as_view(), name='add_category'),
path('dashboard/categories/<str:category_name>', views.CategoryProductsView.as_view(), name='category_products')
Another simpler option is to modify the url of "add_category" and leave it as follows. This way it will not fail. (Take care with order)
path('dashboard/categories/add/add_category', views.AddCategoryView.as_view(), name='add_category'),
path('dashboard/categories/<str:category_name>', views.CategoryProductsView.as_view(), name='category_products')
Upvotes: 2