westerveltco / django-simple-nav

A simple, flexible, and extensible navigation menu for Django
https://django-simple-nav.westervelt.dev
MIT License
10 stars 0 forks source link

`get_context_data` fails if no user is attached to request #44

Closed joshuadavidthomas closed 4 months ago

joshuadavidthomas commented 4 months ago
  File "/home/josh/projects/django-simple-nav/.nox/demo/lib/python3.12/site-packages/django_simple_nav/nav.py", line 30, in render
    context = self.get_context_data(request)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/josh/projects/django-simple-nav/.nox/demo/lib/python3.12/site-packages/django_simple_nav/nav.py", line 25, in get_context_data
    if check_item_permissions(item, request.user)  # type: ignore[arg-type]
                                    ^^^^^^^^^^^^
AttributeError: 'WSGIRequest' object has no attribute 'user'
joshuadavidthomas commented 4 months ago

Quick fix in #42 -- should extract and add further testing to make sure my solution is viable