mojo-navigation 0.0.2
pip install mojo-navigation==0.0.2
Released:
Django app managing simple navigation.
Navigation
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: MIT License (MIT License)
- Author: Guillaume Pousseo
Classifiers
- Development Status
- Environment
- Framework
- Intended Audience
- License
- Operating System
- Programming Language
Project description
MOJO NAVIGATION
This Django app manages navigations trees with simple features. It is highly inspired by django-treenav and django-sitetree. It offers a lighter version to allow easy customisation.
The trees structure is using mptt. Each item offer various options to generate the url, restrict access given user status and permissions, classes and behaviours.
Changelist view:
Add view:
Install
It is strongly recommanded to install this theme from GIT with PIP onto you project virtualenv.
From PyPi
pip install mojo-navigation
From Github
https://github.com/django-mojo/mojo-navigation#egg=mojo-navigation
setup
This application works with django mptt module in order to display the trees. It is highly recommended to add it in the INSTALLED_APPS.
INSTALLED_APPS = (
...
'django_mptt'
...
)
If you want to use the default model and admin, also install the module itself.
INSTALLED_APPS = (
...
'mojo.navigation'
...
)
Then install your model with
python manage.py syncdb
In case you are using South, you can alternatively do:
python manage.py migrate mojo.navigation
Managers
There are 2 main managers to help sortting and filtering the menu items.
Tree
You can get all items of a specific tree by passing its slug in the for_tree manager, for exemple:
tree_items = Item.objects.for_slug('slug_exemple')
User
As we are using permissions for items. You can filter items for a specific user to retrieve all the items he has access to by passing its object in the for_user manager, for exemple:
tree_items = Item.objects.for_user(request.user)
Utils
level
You can limit the number of tree levels of trees. For exemple, some menus can be one or two levels only. In such case its useless to allow the the user to add more.
In order to limit the number of levels you need to create a custom admin class inheriting from mojo.navigation.admin.ItemAdmin and add a level_limit attribute with the desired value.
For exemple, this will limit the tree to two levels:
from mojo.navigation.admin import ItemAdmin
class CustomItemAdmin(ItemAdmin):
level_limit = 1
Contribution
Please feel free to contribute. Any help and advices are much appreciated.
LINKS
Project details
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: MIT License (MIT License)
- Author: Guillaume Pousseo
Classifiers
- Development Status
- Environment
- Framework
- Intended Audience
- License
- Operating System
- Programming Language
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
File details
Details for the file mojo-navigation-0.0.2.tar.gz
.
File metadata
- Download URL: mojo-navigation-0.0.2.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
6ba3a586fc5c6ad785b49d4c377fc31328a21d341bddf2a6dbf949c29a9b2fdf
|
|
MD5 |
4157c32ec52ce7ecd792d04de4398423
|
|
BLAKE2b-256 |
f97ffee522e3a9920e03834ad40502944ec1d1c7323e65fcd68ae945c5381d54
|