# DJANGO OUTBOX MENU
Menu is almost use in every web project.
With this library you can create menu for backend and frontend project without headache.
All you need to do is:
## In your django Environment
### Install package to your environment
> pip install django-outbox-menu
### Add to INSTALLED_APPS
INSTALLED_APPS = [
'django.contrib.sites',
'menu',
]
### Add SITE_ID in user settings.py
SITE_ID = 1
### Include library URLS
urlpatterns += [
path('', include('menu.urls')),
]
### Install requirements
Activate your environment using
> mkvirtualenv env_menu
### Migrate to create table to your database
> python manage.py migrate
## In your django Templates
### Load menu tags
> {% load menu_tags %}
### Generate menu
> {% menu_create FRONTEND 0 as my_menu %}
syntax :
> menu_create <menu_kind> <menu_group> as var_name
> menu_kind : FRONTEND or BACKEND
> menu_group :
0 : None (use only for FRONTEND)
1 : Owner
2 : Manager
3 : Operator
4 : Cashier
etc ... (Update in admin page section [Menu Groups])
> {% for n in my_menu %}
n have all menu fields such as :
n.id
n.parent_id
n.name
n.link
n.icon
n.is_external
n.level
n.haveChild
n.haveChildEndTag
You can use it inside for loop
> example in you templates
<ul class="main-menu">
{% menu_create FRONTEND 0 as my_menu %}
{% for n in my_menu %}
{% if forloop.first %}
<li class="main-menu-active">
{% else %}
<li>
{% endif %}
{% if n.haveChild %}
<a href="#"> {{n.name}}
{% if n.parent_id %}
<i class="zmdi zmdi-chevron-right text-to-right"></i>
{% endif %}
</a>
<ul class="sub-menu">
{% else %}
<a class="clear-content-right" href="#"> {{n.name}} </a>
{% endif %}
{% for i in n.haveChildEndTag %}
<!-- Count = {{forloop.counter}} -->
{% if forloop.last %}
{% if n.parent_id %}
</li></ul>
{% if not n.haveChild %}
</li> <!-- li -->
{% endif %}
{% else %}
</li> <!-- Root -->
{% endif %}
{% else %}
</li></ul>
{% endif %}
{% endfor %}
{% endfor %}
</ul>
### Run project
> python manage.py runserver
on you browser :
127.0.0.1:8000
127.0.0.1:8000/menu
127.0.0.1:8000/admin
Raw data
{
"_id": null,
"home_page": "https://github.com/PROJECT-OUTBOX/authbox_menu.git",
"name": "authbox-menu",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "menu,model base,environment,django",
"author": "",
"author_email": "suratiwan03@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/4c/23/88f58013e5d05ca0ba3bd6166d5c80e2807512055b30c127ab93719b00d9/authbox-menu-1.0.0.tar.gz",
"platform": null,
"description": "# DJANGO OUTBOX MENU\n\nMenu is almost use in every web project. \n\nWith this library you can create menu for backend and frontend project without headache.\nAll you need to do is: \n\n\n## In your django Environment\n\n### Install package to your environment\n > pip install django-outbox-menu\n\n### Add to INSTALLED_APPS\n INSTALLED_APPS = [ \n 'django.contrib.sites', \n 'menu',\n ]\n\n### Add SITE_ID in user settings.py\n SITE_ID = 1\n\n### Include library URLS\n urlpatterns += [\n path('', include('menu.urls')),\n ]\n\n### Install requirements\n Activate your environment using\n > mkvirtualenv env_menu \n\n### Migrate to create table to your database\n > python manage.py migrate\n\n## In your django Templates\n\n### Load menu tags\n > {% load menu_tags %}\n\n### Generate menu\n > {% menu_create FRONTEND 0 as my_menu %} \n syntax :\n > menu_create <menu_kind> <menu_group> as var_name\n > menu_kind : FRONTEND or BACKEND\n > menu_group : \n 0 : None (use only for FRONTEND)\n 1 : Owner\n 2 : Manager\n 3 : Operator\n 4 : Cashier\n etc ... (Update in admin page section [Menu Groups])\n\n > {% for n in my_menu %}\n n have all menu fields such as :\n n.id\n n.parent_id\n n.name\n n.link\n n.icon\n n.is_external\n n.level\n n.haveChild\n n.haveChildEndTag\n You can use it inside for loop\n\n > example in you templates\n <ul class=\"main-menu\">\n {% menu_create FRONTEND 0 as my_menu %} \n {% for n in my_menu %}\n\n {% if forloop.first %} \n <li class=\"main-menu-active\">\n {% else %}\n <li>\n {% endif %}\n\n {% if n.haveChild %}\n <a href=\"#\"> {{n.name}}\n {% if n.parent_id %}\n <i class=\"zmdi zmdi-chevron-right text-to-right\"></i>\n {% endif %}\n </a>\n <ul class=\"sub-menu\"> \n {% else %} \n <a class=\"clear-content-right\" href=\"#\"> {{n.name}} </a> \n {% endif %}\n \n \n {% for i in n.haveChildEndTag %}\n <!-- Count = {{forloop.counter}} -->\n {% if forloop.last %}\n {% if n.parent_id %}\n </li></ul>\n {% if not n.haveChild %} \n </li> <!-- li --> \n {% endif %} \n {% else %}\n </li> <!-- Root -->\n {% endif %}\n\n {% else %}\n </li></ul>\n {% endif %} \n\n {% endfor %} \n \n {% endfor %} \n </ul> \n\n### Run project\n > python manage.py runserver\n on you browser :\n 127.0.0.1:8000\n 127.0.0.1:8000/menu\n 127.0.0.1:8000/admin\n",
"bugtrack_url": null,
"license": "",
"summary": "Auto create menu base on table values",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/PROJECT-OUTBOX/authbox_menu.git"
},
"split_keywords": [
"menu",
"model base",
"environment",
"django"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5b585b92357d4b612424acd6344a418da14174dc2bdcd678cb108aa0b4bf3f5b",
"md5": "3144aa06ad48d696aebb226dc951c0fc",
"sha256": "7c6e488d5ed311985aab8bce88575589c5adef8e1d1bf2e6bd0a4d5b45de4f1e"
},
"downloads": -1,
"filename": "authbox_menu-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3144aa06ad48d696aebb226dc951c0fc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 30822,
"upload_time": "2024-03-14T06:53:26",
"upload_time_iso_8601": "2024-03-14T06:53:26.084068Z",
"url": "https://files.pythonhosted.org/packages/5b/58/5b92357d4b612424acd6344a418da14174dc2bdcd678cb108aa0b4bf3f5b/authbox_menu-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4c2388f58013e5d05ca0ba3bd6166d5c80e2807512055b30c127ab93719b00d9",
"md5": "efe126d7d793b36bde2202ebd6e82963",
"sha256": "5b86fe6212a1578c0d40ddb195f29efec8c60f5789192c4a25b27014884e97b6"
},
"downloads": -1,
"filename": "authbox-menu-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "efe126d7d793b36bde2202ebd6e82963",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 23805,
"upload_time": "2024-03-14T06:53:27",
"upload_time_iso_8601": "2024-03-14T06:53:27.859196Z",
"url": "https://files.pythonhosted.org/packages/4c/23/88f58013e5d05ca0ba3bd6166d5c80e2807512055b30c127ab93719b00d9/authbox-menu-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-14 06:53:27",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "PROJECT-OUTBOX",
"github_project": "authbox_menu",
"github_not_found": true,
"lcname": "authbox-menu"
}