[Django]-Category() got an unexpected keyword argument 'category_name_slug'

3👍

Your category() view expects the category_name_url parameter:

def category(request, category_name_url):
    ...

But in the urls.py your define the category_name_slug parameter:

url(r'category/(?P<category_name_slug>[\w\-]+)/$', views.category,
                                                   name='category'),

Make the parameter equal in both places. For example:

def category(request, slug):
    ...

But in the urls.py your define the category_name_slug parameter:

url(r'category/(?P<slug>[\w\-]+)/$', views.category, name='category'),

2👍

You should change your url definition to:

url(r'category/(?P<slug>[\w\-]+)/$', views.category, name='category')

Leave a comment