# 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/django_lib_outbox_menu.git",
"name": "django-outbox-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/f7/11/7666055dd8fa3e8b16ef55b7f900aea999c51da6087e3533082f860b5804/django-outbox-menu-1.1.30.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": "DJANGO OUTBOX MENU",
"version": "1.1.30",
"project_urls": {
"Homepage": "https://github.com/PROJECT-OUTBOX/django_lib_outbox_menu.git"
},
"split_keywords": [
"menu",
"model base",
"environment",
"django"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c6927d2769b529122a1141edd9744f22ca3291f296dccfa991a44933d56de335",
"md5": "2c138753e626a71e2421d783285ac4bd",
"sha256": "bcb3d3a15ae47f878f670c428bab3ec7b00e925f4f41a12a0853bd17435b2904"
},
"downloads": -1,
"filename": "django_outbox_menu-1.1.30-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2c138753e626a71e2421d783285ac4bd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 639238,
"upload_time": "2023-09-12T03:49:10",
"upload_time_iso_8601": "2023-09-12T03:49:10.999831Z",
"url": "https://files.pythonhosted.org/packages/c6/92/7d2769b529122a1141edd9744f22ca3291f296dccfa991a44933d56de335/django_outbox_menu-1.1.30-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f7117666055dd8fa3e8b16ef55b7f900aea999c51da6087e3533082f860b5804",
"md5": "cd35794765b2f9d27b38bd9e7dfd0cff",
"sha256": "eaabb14f1ae77e4f735e97a714f4e55e4ac9cadfee0439d54acb623bd185a81d"
},
"downloads": -1,
"filename": "django-outbox-menu-1.1.30.tar.gz",
"has_sig": false,
"md5_digest": "cd35794765b2f9d27b38bd9e7dfd0cff",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 626237,
"upload_time": "2023-09-12T03:49:13",
"upload_time_iso_8601": "2023-09-12T03:49:13.287452Z",
"url": "https://files.pythonhosted.org/packages/f7/11/7666055dd8fa3e8b16ef55b7f900aea999c51da6087e3533082f860b5804/django-outbox-menu-1.1.30.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-12 03:49:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "PROJECT-OUTBOX",
"github_project": "django_lib_outbox_menu",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "asgiref",
"specs": [
[
"==",
"3.5.2"
]
]
},
{
"name": "attrs",
"specs": [
[
"==",
"22.1.0"
]
]
},
{
"name": "Automat",
"specs": [
[
"==",
"20.2.0"
]
]
},
{
"name": "backports.zoneinfo",
"specs": [
[
"==",
"0.2.1"
]
]
},
{
"name": "click",
"specs": [
[
"==",
"8.1.3"
]
]
},
{
"name": "constantly",
"specs": [
[
"==",
"15.1.0"
]
]
},
{
"name": "Django",
"specs": [
[
"==",
"4.1.1"
]
]
},
{
"name": "django-parler",
"specs": [
[
"==",
"2.3"
]
]
},
{
"name": "hyperlink",
"specs": [
[
"==",
"21.0.0"
]
]
},
{
"name": "idna",
"specs": [
[
"==",
"3.4"
]
]
},
{
"name": "incremental",
"specs": [
[
"==",
"21.3.0"
]
]
},
{
"name": "mysqlclient",
"specs": [
[
"==",
"2.1.1"
]
]
},
{
"name": "six",
"specs": [
[
"==",
"1.16.0"
]
]
},
{
"name": "sqlparse",
"specs": [
[
"==",
"0.4.3"
]
]
},
{
"name": "Twisted",
"specs": [
[
"==",
"22.8.0"
]
]
},
{
"name": "typing_extensions",
"specs": [
[
"==",
"4.4.0"
]
]
},
{
"name": "zope.interface",
"specs": [
[
"==",
"5.4.0"
]
]
}
],
"lcname": "django-outbox-menu"
}