All Projects → LaLogiaDePython → django-menu-generator

LaLogiaDePython / django-menu-generator

Licence: MIT license
A straightforward menu generator for Django

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to django-menu-generator

PHP-Quick-Menu
This is a PHP Multilevel Menu class. From nested Json|Array to Html menu (ul)
Stars: ✭ 25 (+4.17%)
Mutual labels:  menubar, menu-generator, menu-navigation, menu-item
Side Menu.ios
Animated side menu with customizable UI
Stars: ✭ 2,702 (+11158.33%)
Mutual labels:  menubar, menu, menu-navigation
Spotmenu
Stars: ✭ 2,668 (+11016.67%)
Mutual labels:  menubar, menu
oc-menumanager-plugin
A Menu Management Plugin for October CMS
Stars: ✭ 29 (+20.83%)
Mutual labels:  menu, menu-navigation
menutray
An application menu through a GTK+ tray status icon.
Stars: ✭ 62 (+158.33%)
Mutual labels:  menu, menu-generator
React Site Nav
A kick ass site menu powered by styled components inspired by Stripe.
Stars: ✭ 155 (+545.83%)
Mutual labels:  menubar, menu
Vue Dock Menu
⚓Dockable Menu bar for Vue
Stars: ✭ 183 (+662.5%)
Mutual labels:  menubar, menu
curved-menu
VanillaJS fully configurable curved menu (circular navigation)
Stars: ✭ 30 (+25%)
Mutual labels:  menu, menu-navigation
WebUpdate
Simple JSON based WebUpdate
Stars: ✭ 32 (+33.33%)
Mutual labels:  simple, no-database
vue-bottom-navigation
Vue bottom navigation
Stars: ✭ 56 (+133.33%)
Mutual labels:  menu, menu-navigation
Chinese Lunar Calendar For Mac
Chinese Lunar Calendar for Mac
Stars: ✭ 150 (+525%)
Mutual labels:  menubar, menu
drawer
A touch-enabled drawer component for the modern web.
Stars: ✭ 26 (+8.33%)
Mutual labels:  menu, menu-navigation
Yndropdownmenu
✨ Awesome Dropdown menu for iOS with Swift 5.0
Stars: ✭ 1,259 (+5145.83%)
Mutual labels:  menubar, menu
Nocturnal
A Dimness and Night Shift menu bar app for macOS 🌙
Stars: ✭ 199 (+729.17%)
Mutual labels:  menubar, menu
Ngsplitmenucontroller
Menu Driven Split view controller
Stars: ✭ 61 (+154.17%)
Mutual labels:  menubar, menu
Superslide.js
A flexible, smooth, GPU accelerated sliding menu for your next PWA
Stars: ✭ 496 (+1966.67%)
Mutual labels:  menubar, menu
WaveSideBar
Animated side bar view
Stars: ✭ 38 (+58.33%)
Mutual labels:  menubar, menu
Radialmenu
A highly customizable radial menu that's very easy to setup.
Stars: ✭ 371 (+1445.83%)
Mutual labels:  menubar, menu
ContextMenuSwift
A better version of iOS 13 Context Menu
Stars: ✭ 162 (+575%)
Mutual labels:  menubar, menu
CodeIgniter-Adjacency-List
Simple implementation with nestedSortable plugin.
Stars: ✭ 18 (-25%)
Mutual labels:  menu-generator, menu-navigation

Django Menu Generator

A menu generating application for Django

status-image version-image coverage-image

A productivity tool that enables the generation of full featured menus through python dictionaries list, you only need to setup the HTML structure once for each menu you like to build and then use the dictionaries to generate menu items

Features:

  • Tested support to Python 3.4, 3.5, 3.6, 3.7, 3.8
  • Tested support to Django 1.8, 1.9, 1.10, 1.11, 2.0, 2.2, 3.0, 3.1
  • No database
  • Support unlimited menus
  • Icons support
  • Semi-Automatically identifies the selected item and his breadcrums
  • Conditional menu items display through validators (Permissions, Authentications or whatever you want)

Documentation:

The full documentation for Django Menu Generator is allowed here:

http://django-menu-generator.readthedocs.io/en/latest/index.html

Installation:

You can install it with one of these options:

  • easy_install django-menu-generator
  • pip install django-menu-generator
  • git clone https://github.com/LaLogiaDePython/django-menu-generator
    1. cd django-menu-generator
    2. run python setup.py
  • wget https://github.com/LaLogiaDePython/django-menu-generator/zipball/master
    1. unzip the downloaded file
    2. cd into django-menu-generator-* directory
    3. run python setup.py

Usage:

  1. Once installed, add 'menu_generator' to your INSTALLED_APPS.
  2. Add {% load menu_generator %} to templates that will handle the menus.
  3. Add the list dictionaries containing the menu items to the settings
####################################################################################
Example: settings.py
####################################################################################

NAV_MENU_LEFT = [
    {
        "name": "Home",
        "url": "/",
    },
    {
        "name": "About",
        "url": "/about",
    },
]

NAV_MENU_RIGHT = [
    {
        "name": "Login",
        "url": "login_url_view",  # reversible
        "validators": ["menu_generator.validators.is_anonymous"],
    },
    {
        "name": "Register",
        "url": "register_view_url",  # reversible
        "validators": ["menu_generator.validators.is_anonymous"],
    },
    {
        "name": "Account",
        "url": "/acount",
        "validators": ["menu_generator.validators.is_authenticated"],
        "submenu": [
            {
                "name": "Profile",
                "url": "/account/profile",
            },
            {
                "name": "Account Balance",
                "url": "/account/balance",
                "validators": ["myapp.profiles.is_paid_user"],
            },
            {
                "name": "Account Secrets",
                "url": "/account/secrets",
                "validators": ["menu_generator.validators.is_superuser"],
            }
        ],
    },
]

FOOTER_MENU_LEFT = [
    {
        "name": "Facebook",
        "url": "facebook.com/foobar",
    },
    {
        "name": "Contact US",
        "url": "/contact",
    },
]

FOOTER_MENU_RIGHT = [
    {
        "name": "Address",
        "url": "/address",
    },
]

Or you can build the menu dictionaries list inside the project apps with menus.py files, see docs for more.

  1. In your template, load the template tag to generate your menu.
{% load menu_generator %}
<!DOCTYPE html>
<html>
    <head><title>Django Menu Generator</title></head>
    <body>
        <!-- NAV BAR Start -->
        {% get_menu "NAV_MENU_LEFT" as left_menu %}
        <div style="float:left;">
            {% for item in left_menu %}
                <li class="{% if item.selected %} active {% endif %}">
                <a href="{{ item.url }}"> <i class="{{ item.icon_class }}"></i> {{ item.name }}</a>
                </li>
                {% if item.submenu %}
                    <ul>
                    {% for menu in item.submenu %}
                        <li class="{% if menu.selected %} active {% endif %}">
                            <a href="{{ menu.url }}">{{ menu.name }}</a>
                        </li>
                    {% endfor %}
                    </ul>
                {% endif %}
            {% endfor %}
        </div>

        {% get_menu "NAV_MENU_RIGHT" as right_menu %}
        <div style="float:right;">
            {% for item in right_menu %}
                <li class="{% if item.selected %} active {% endif %}">
                    <a href="{{ item.url }}">{{ item.name }}</a>
                </li>
                {% if item.submenu %}
                    <ul>
                    {% for menu in item.submenu %}
                        <li class="{% if menu.selected %} active {% endif %}">
                            <a href="{{ menu.url }}">{{ menu.name }}</a>
                        </li>
                    {% endfor %}
                    </ul>
                {% endif %}
            {% endfor %}
        </div>
        <!-- NAV BAR End -->

        <!-- Footer Start -->
        {% get_menu "FOOTER_MENU_LEFT" as left_footer_menu %}
        <div style="float:left;">
            <!-- loop through your left footer menus -->
        </div>

        {% get_menu "FOOTER_MENU_RIGHT" as right_footer_menu %}
        <div style="float:right;">
            <!-- loop through your right footer menus -->
        </div>
        <!-- Footer End -->
    </body>
</html>
  1. Now you must to see your menus generated when you run your project

Running the tests:

To run the tests against configured environments:

tox

License:

Released under a (MIT) license.

Author and mantainers:

Milton Lenis - [email protected]

Juan Diego García - [email protected]

Credits:

We would like to thank Val Kneeman, the original author of this project under the name 'menuware' https://github.com/un33k/django-menuware

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].