westerveltco / django-simple-nav

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

Unable to nest `django_simple_nav` templatetags #43

Closed joshuadavidthomas closed 7 months ago

joshuadavidthomas commented 7 months ago

Need to adjust either the templatetag or the render method of the Nav to pass in the request always.

  File "/home/josh/.pyenv/versions/nav-3.12/lib/python3.12/site-packages/django/template/base.py", line 961, in render_annotated
    return self.render(context)
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/josh/projects/django-simple-nav/src/django_simple_nav/templatetags/django_simple_nav.py", line 48, in render
    return nav.render(context["request"], self.template_name)
                      ~~~~~~~^^^^^^^^^^^
  File "/home/josh/.pyenv/versions/nav-3.12/lib/python3.12/site-packages/django/template/context.py", line 83, in __getitem__
    raise KeyError(key)
KeyError: 'request'
joshuadavidthomas commented 7 months ago

This is solved in #42 -- should extract the code related to that and create a PR dedicated only to fixing this issue.

joshuadavidthomas commented 7 months ago

close in an accidental push to main