{"id":21153,"library":"django-navhelper","title":"django-navhelper","description":"Provides Django template tags to help render navigation menus and breadcrumbs from a hierarchical structure of sections. Version 1.0.0 requires Django 4.2+ and drops support for older Django versions. Released as needed, currently stable.","status":"active","version":"1.0.0","language":"python","source_language":"en","source_url":"https://github.com/geelweb/django-navhelper","tags":["django","navigation","menu","template-tags","breadcrumbs"],"install":[{"cmd":"pip install django-navhelper","lang":"bash","label":"Latest stable"}],"dependencies":[{"reason":"Required for template tags and ORM.","package":"django","optional":false}],"imports":[{"note":"Main class for building navigation structures.","symbol":"NavHelper","correct":"from navhelper import NavHelper"},{"note":"The templatetags module is imported directly; no submodule for individual tags.","wrong":"from navhelper.templatetags.navhelper import ...","symbol":"register_nav_tag","correct":"from navhelper.templatetags import navhelper"}],"quickstart":{"code":"# settings.py\nINSTALLED_APPS = [\n    ...\n    'navhelper',\n]\n\n# models.py\nfrom django.db import models\nfrom navhelper import NavHelper\n\nclass Section(models.Model):\n    title = models.CharField(max_length=100)\n    slug = models.SlugField()\n    parent = models.ForeignKey('self', null=True, blank=True, on_delete=models.CASCADE)\n    url = models.CharField(max_length=200, blank=True)\n\n    def __str__(self):\n        return self.title\n\n# urls.py\nfrom django.urls import path\nfrom . import views\n\nurlpatterns = [\n    path('', views.home, name='home'),\n    path('section/<slug:slug>/', views.section_detail, name='section_detail'),\n]\n\n# template.html\n{% load navhelper %}\n<ul>\n{% navhelper_menu sections %}\n</ul>","lang":"python","description":"Set up a Section model with parent hierarchy, add 'navhelper' to INSTALLED_APPS, then use the navhelper_menu template tag to render a nested menu."},"warnings":[{"fix":"Ensure Django >= 4.2 is installed: pip install 'django>=4.2'","message":"Version 1.0.0 drops support for Django versions older than 4.2. Upgrade your Django version to 4.2+ before updating.","severity":"breaking","affected_versions":"<1.0.0 to 1.0.0"},{"fix":"Use a model like Section with parent ForeignKey and define a 'children' property or use reverse relation. Example: prefetch_related('section_set') and set children attribute manually.","message":"The template tag expects a queryset or list of objects with 'parent' and 'children' attributes. Ensure your model has foreign key to self and a method/attribute for children (e.g., via prefetch_related).","severity":"gotcha","affected_versions":"all"},{"fix":"Check documentation for 'current' argument in template tag usage.","message":"The navhelper_menu tag may not automatically handle active state. You might need to pass 'current' parameter or implement custom logic for highlighting current section.","severity":"gotcha","affected_versions":"1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Add 'navhelper' to INSTALLED_APPS in settings.py.","cause":"The navhelper templates are not available because the app's templates directory is not found. Ensure 'navhelper' is in INSTALLED_APPS.","error":"TemplateDoesNotExist: navhelper/menu.html"},{"fix":"Define a model with parent ForeignKey and use prefetch_related('children') if you have a related_name set. Alternatively, add a 'children' property that returns the queryset of siblings.","cause":"The template tag expects a 'children' attribute on each node, but your model does not have it. You need to set up reverse relation (e.g., children = models.ForeignKey(...)) or pass a queryset with prefetched children.","error":"'NoneType' object has no attribute 'children'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}