diff --git a/.travis.yml b/.travis.yml index e9ae8e0..0ae1a37 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,8 +14,12 @@ env: install: - pip install -r requirements.txt + - pip install flake8 - pip install coveralls +before_script: + flake8 . + script: coverage run --source=menu_generator manage.py test after_success: diff --git a/README.md b/README.md deleted file mode 100755 index 0a78d9f..0000000 --- a/README.md +++ /dev/null @@ -1,208 +0,0 @@ -# Django Menu Generator -> A menu generating application for Django - -[![status-image]][status-link] -[![version-image]][version-link] -[![coverage-image]][coverage-link] - -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 2.7, 3.4, 3.5, 3.6 -- Tested support to Django 1.8.18, 1.9.13, 1.10.7, 1.11 -- 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) - -## Installation: - -You can install it with one of these options: -- easy_install django-menu-generator -- pip install django-menu-generator -- git clone http://github.com/un33k/django-menu-generator - 1. cd django-menu-generator - 2. run python setup.py -- wget https://github.com/un33k/django-menu-generator/zipball/master - 1. unzip the downloaded file - 2. cd into django-menu-generator-* directory - 3. run python setup.py - -## Usage: - -1. Install 'django-menu-generator' as per the above instructions. -2. Add 'menu_generator' to your INSTALLED_APPS. -3. Add {% load menu_generator %} to templates that will handle the menus. - -```python -#################################################################################### -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", - }, -] -``` - -You can build the menu dictionaries list inside the project apps with ``menus.py`` files, see the docs for more. - -Then in your template, load the template tag to generate your menu. - - ```html - - {% load menu_generator %} - - - - Django Menu Generator - - - {% get_menu "NAV_MENU_LEFT" as left_menu %} -
- {% for item in left_menu %} -
  • - {{ item.name }} -
  • - {% if item.submenu %} - - {% endif %} - {% endfor %} -
    - - {% get_menu "NAV_MENU_RIGHT" as right_menu %} -
    - {% for item in right_menu %} -
  • - {{ item.name }} -
  • - {% if item.submenu %} - - {% endif %} - {% endfor %} -
    - - - - {% get_menu "FOOTER_MENU_LEFT" as left_footer_menu %} -
    - -
    - - {% get_menu "FOOTER_MENU_RIGHT" as right_footer_menu %} -
    - -
    - - - - ``` - -## Running the tests: - -To run the tests against the current environment: - - python manage.py test - - -## License: - -Released under a ([MIT](LICENSE)) license. - -## Author and mantainers: - -[Milton Lenis](https://github.com/MiltonLn) - miltonln04@gmail.com - -## Credits: - -I'd like to thank [Val Kneeman][valkneeman-link], the original author of this project under the name 'menuware' -https://github.com/un33k/django-menuware - - - -[status-image]: https://travis-ci.org/RADYConsultores/django-menu-generator.svg?branch=master -[status-link]: https://travis-ci.org/RADYConsultores/django-menu-generator?branch=master - -[version-image]: https://img.shields.io/pypi/v/django-menu-generator.svg -[version-link]: https://pypi.python.org/pypi/django-menu-generator - -[coverage-image]: https://coveralls.io/repos/github/RADYConsultores/django-menu-generator/badge.svg?branch=master -[coverage-link]: https://coveralls.io/github/RADYConsultores/django-menu-generator?branch=master - -[download-image]: https://img.shields.io/pypi/dm/django-menu-generator.svg -[download-link]: https://pypi.python.org/pypi/django-menu-generator - -[valkneeman-link]: https://github.com/un33k - diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..72a66b0 --- /dev/null +++ b/README.rst @@ -0,0 +1,221 @@ +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 2.7, 3.4, 3.5, 3.6 +- Tested support to Django 1.8.18, 1.9.13, 1.10.7, 1.11 +- 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) + +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/RADYConsultores/django-menu-generator + + 1. cd django-menu-generator + 2. run python setup.py + +- wget https://github.com/RADYConsultores/django-menu-generator/zipball/master + + 1. unzip the downloaded file + 2. cd into django-menu-generator-\* directory + 3. run python setup.py + +Usage: +------ + +1. Install 'django-menu-generator' as per the above instructions. +2. Add 'menu\_generator' to your INSTALLED\_APPS. +3. Add {% load menu\_generator %} to templates that will handle the + menus. + +.. code:: python + + #################################################################################### + 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", + }, + ] + +You can build the menu dictionaries list inside the project apps with +``menus.py`` files, see the docs for more. + +Then in your template, load the template tag to generate your menu. + + +{% load menu\_generator %} + +:: + + + + Django Menu Generator + + + {% get_menu "NAV_MENU_LEFT" as left_menu %} +
    + {% for item in left_menu %} +
  • + {{ item.name }} +
  • + {% if item.submenu %} + + {% endif %} + {% endfor %} +
    + + {% get_menu "NAV_MENU_RIGHT" as right_menu %} +
    + {% for item in right_menu %} +
  • + {{ item.name }} +
  • + {% if item.submenu %} + + {% endif %} + {% endfor %} +
    + + + + {% get_menu "FOOTER_MENU_LEFT" as left_footer_menu %} +
    + +
    + + {% get_menu "FOOTER_MENU_RIGHT" as right_footer_menu %} +
    + +
    + + + + + + +Running the tests: +------------------ + +To run the tests against the current environment: + +:: + + python manage.py test + +License: +-------- + +Released under a (`MIT `__) license. + +Author and mantainers: +---------------------- + +`Milton Lenis `__ - miltonln04@gmail.com + +`Juan Diego GarcĂ­a `__ - juandgoc@gmail.com + +Credits: +-------- + +I'd like to thank `Val Kneeman `__, the +original author of this project under the name 'menuware' +https://github.com/un33k/django-menuware + +.. |status-image| image:: https://travis-ci.org/RADYConsultores/django-menu-generator.svg?branch=master + :target: https://travis-ci.org/RADYConsultores/django-menu-generator?branch=master +.. |version-image| image:: https://img.shields.io/pypi/v/django-menu-generator.svg + :target: https://pypi.python.org/pypi/django-menu-generator +.. |coverage-image| image:: https://coveralls.io/repos/github/RADYConsultores/django-menu-generator/badge.svg?branch=master + :target: https://coveralls.io/github/RADYConsultores/django-menu-generator?branch=master \ No newline at end of file diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..f1f2406 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[flake8] +max-line-length = 122 \ No newline at end of file diff --git a/setup.py b/setup.py index 6e1b6db..feea2cc 100755 --- a/setup.py +++ b/setup.py @@ -89,5 +89,4 @@ def get_package_data(package): package_data=get_package_data(package), install_requires=install_requires, classifiers=classifiers, - )