Package: django-treenav
Build Statusmaster:develop:An extensible, hierarchical, and pluggable navigation system for Django sites.django-treenavwas designed from the start to live independent of a CMS
implementation. As a separate application, treenav can easily be integrated
into existing, custom setups and does not enforce or require users to use a
particular content management system.Sharing the same principles,django-pageletsintegrates seamlessly with treenav and can be used together to create a flexible
CMS product.For complete documentation checkout,http://django-treenav.readthedocs.orgFeaturesGeneric functionality with multiple URL specifications:get_absolute_url(),reverse(), or raw URLsPackaged with templates to render the tree hierarchy with nested<ul>’s, but can easily be overridden with custom templatesEasily customize each item’s template or fall back to a defaultmenuitem.htmlUseful CSS classes for flexible UI customizationAutomatically sets “active” on item and item’s parents ifPATH_INFOis equal toitem.hrefEfficient: minimizes database access with django-mptt functionalityCaches the tree so that repeated page views do not hit the database.Simple links in theMenuItemlist view for refreshing the cache and href
from the database.Requirementsdjango>= 2.2django-mptt>= 0.11.0Using the demoFor a quick demo, follow these steps:Create a virtualenv. (This example usesmkvirtualenv, but there are many other
ways to do it):$ mkvirtualenv django-treenavCheck out the code and install the requirements:(django-treenav)$ git clone git://github.com/caktus/django-treenav.git
(django-treenav)$ cd django-treenav/
(django-treenav)~/django-treenav/$ pip install -Ur dev-requirements.txtRun migrations and create a superuser so you can login to the Django admin:(django-treenav)~/django-treenav$ python manage.py migrate
(django-treenav)~/django-treenav$ python manage.py createsuperuserRun the server:(django-treenav)~/django-treenav$ python manage.py runserverVisithttp://localhost:8000/in your browser and follow the instructions.InstallationInstall the app with pip:pip install django-treenavAdd to yourINSTALLED_APPSand run migrate:INSTALLED_APPS = (
    ...,
    'mptt',
    'treenav',
)Include these context processors:TEMPLATES = [
  {
    'OPTIONS': {
      'context_processors': [
        "django.template.context_processors.request",
        "treenav.context_processors.treenav_active",
      ],
    },
  },
]Add these urls:urlpatterns = [
    url(r'^treenav/', include('treenav.urls')),
]Maintainer InformationWe use Github Actions to lint (using pre-commit, black, isort, and flake8),
test (using tox and tox-gh-actions), calculate coverage (using coverage), and build
documentation (using sphinx).We have a local script to do these actions locally, namedmaintain.sh:$ ./maintain.shA Github Action workflow also builds and pushes a new package to PyPI whenever a new
Release is created in Github. This uses a project-specific PyPI token, as described in
thePyPI documentation here. That token has been
saved in thePYPI_PASSWORDsettings for this repo, but has not been saved anywhere
else so if it is needed for any reason, the current one should be deleted and a new one
generated.As always, be sure to bump the version intreenav/__init__.pybefore creating a
Release, so that the proper version gets pushed to PyPI.Development sponsored byCaktus Consulting Group, LLC.