Navigation system for django sites
Project description
Multiple navigation system for django sites.
Django Lineup lets you manage a tree of items. Each first level node represents a menu you can include in your templates.
Documentation
The full documentation is at https://django-lineup.readthedocs.io.
Quickstart
Install Django Lineup:
pip install django-lineup
Add it to your INSTALLED_APPS:
INSTALLED_APPS = (
...
'lineup.apps.LineupConfig',
...
)
Be sure the requests context processor is included (it is by default):
TEMPLATES = [
{
'OPTIONS': {
'context_processors': [
"django.template.context_processors.request",
],
},
},
]
Render a menu::
{% load lineup_tags %} {% lineup_menu 'my-root-item-slug '%}
Render the breadcrumbs::
{% load lineup_tags %} {% lineup_breadcrumbs 'my-root-item-slug '%}
Import a menu from a json::
$ python manage.py import_menu_from_json
Json example::
{ "label": "Main Menu", "slug": "main-menu", "order": 0, "children": [ { "label": "Tools", "slug": "tools", "order": 0, "children": [ { "label": "DNS Tools", "slug": "dns-tools", "order": 0, "login_required": true, "children": [ { "label": "DMARC DNS Tools", "slug": "dmarc-dns-tools", "link": "/dmarc-tools/", "title": "DMARC Rulez", "order": 0 } ] }, { "label": "Password Generator", "slug": "password-generator", "order": 1 } ] }, { "label": "Disabled Item", "slug": "disabled-item", "order": 1, "enabled": false, "children": [ { "label": "Disabled child", "slug": "disabled-child", "order": 0 } ] }, { "label": "Perm Item", "slug": "perm-item", "order": 2, "permissions": [ "add_permission", "view_session" ] } ] }
Features
Multiple menus supported
Render menu tree templatetags
Breadcrumbs templetetag
Import a menu from json management command
Django Baton integration to highlight different menu in the admin
Running Tests
Does the code actually work?
source <YOURVIRTUALENV>/bin/activate (myenv) $ pip install -r requirements_test.txt (myenv) $ python runtests.py
Development commands
pip install -r requirements_dev.txt invoke -l
Example app
This example is provided as a convenience feature to allow potential users to try the app straight from the app repo without having to create a django project.
It can also be used to develop the app in place.
To run this example, follow these instructions:
Navigate to the root directory of your application (same as manage.py)
Install the requirements for the package:
pip install -r requirements_test.txt
Make and apply migrations
python manage.py makemigrations
python manage.py migrate
Run the server
python manage.py runserver
Access from the browser at http://127.0.0.1:8000
Admin user account is admin:admin
Credits
Django Lineup is developed by Otto SRL.
Tools used in rendering this package:
History
0.1.0 (2020-12-11)
First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django_lineup-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3596959160df1a2fb6cbbeea0e0d6d773a81aa522e8f359a258d0cfaec2a2677 |
|
MD5 | 1b4335afb2ced8da9e41bc3875319576 |
|
BLAKE2b-256 | 0df4f751622618010fad41dbf5347296a44033f22e738eb15e10b209fab52d17 |