tj-django / django-view-breadcrumbs

Breadcrumb mixins for django views. Create breadcrumbs in seconds.
https://tj-django.github.io/django-view-breadcrumbs/#/
BSD 3-Clause "New" or "Revised" License
76 stars 8 forks source link

Namespace Issue #714

Closed Stonerocker closed 1 year ago

Stonerocker commented 1 year ago

Is there an existing issue for this?

Does this issue exist in the latest version?

Describe the bug?

I am trying to reproduce the examples given in the description. With a books/views.py like this,

...
class BookListView(ListBreadcrumbMixin, ListView):
    model = Books
...

a books/urls.py like this,

...
urlpatterns = [
    ...
    path("", BookListView.as_view(), name=BookListView.list_view_name),
    ]
...

and an urls.py:

...
urlpatterns = [
    path('books/', include('books.urls')),
    ]
...

I get an error message: NoReverseMatch at /books/ 'books' is not a registered namespace

Reversing the inherited classes in books/views.py,

...
class BookListView(ListView, ListBreadcrumbMixin):
    model = Books
...

fixes the error. However, the code doesn't produce any breadcrumbs.

Apologies, but I am not getting any further. I need some help.

To Reproduce

  1. create empty django project
  2. create app 'books'
  3. write "urls.py", "books/urls.py", "books/views.py", "templates/books/base.html", "templates/books/app_list.html" ... according to example code in description.

What OS are you seeing the problem on?

Ubuntu

Expected behavior?

I would like to see breadcrumbs.

Relevant log output

NoReverseMatch at /books/

'books' is not a registered namespace

Request Method:     GET
Request URL:    http://localhost:8000/books/
Django Version:     4.2.3
Exception Type:     NoReverseMatch
Exception Value:    

'books' is not a registered namespace

Exception Location:     /home/stonerocker/repositories/Django-breadcrumbs/.venv/lib/python3.10/site-packages/django/urls/base.py, line 82, in reverse
Raised during:  books.views.BookListView
Python Executable:  /home/stonerocker/repositories/Django-breadcrumbs/.venv/bin/python
Python Version:     3.10.6
Python Path:    

['/home/stonerocker/repositories/Django-breadcrumbs',
 '/usr/lib/python310.zip',
 '/usr/lib/python3.10',
 '/usr/lib/python3.10/lib-dynload',
 '/home/stonerocker/repositories/Django-breadcrumbs/.venv/lib/python3.10/site-packages']

Anything else?

No response

Code of Conduct

github-actions[bot] commented 1 year ago

Thanks for reporting this issue, don't forget to star this project if you haven't already to help us reach a wider audience.

Stonerocker commented 1 year ago

Apologies! The app_name variable must be referenced, as it is clearly described in the docs. I over read this.