Skip to content

Commit 0f89ba9

Browse files
authored
Update README.md
1 parent b41aca1 commit 0f89ba9

File tree

1 file changed

+120
-110
lines changed

1 file changed

+120
-110
lines changed

README.md

+120-110
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,111 @@
1-
Django Menu Generator
2-
====================
3-
4-
**A menu generating application for Django**
1+
# Django Menu Generator
2+
> A menu generating application for Django
53
64
[![status-image]][status-link]
75
[![version-image]][version-link]
86
[![coverage-image]][coverage-link]
97

10-
Overview
11-
====================
12-
13-
Generates **Simple Navigation** for Django projects/apps, while keeping it **DRY**.
14-
15-
How to install
16-
====================
17-
18-
2. pip install django-menu-generator
19-
3. git clone http://github.com/un33k/django-menu-generator
20-
a. cd django-menu-generator
21-
b. run python setup.py
22-
4. wget https://github.com/un33k/django-menu-generator/zipball/master
23-
a. unzip the downloaded file
24-
b. cd into django-menu-generator-* directory
25-
c. run python setup.py
26-
27-
How to use
28-
====================
29-
1. Install `django-menu-generator` as per the above instructions.
30-
2. Add `menu-generator` to your `INSTALLED_APPS`.
31-
3. Add `{% load menu-generator %}` to templates that require it.
32-
33-
```python
34-
####################################################################################
35-
Example: settings.py
36-
####################################################################################
37-
38-
NAV_MENU_LEFT = [
39-
{
40-
"name": "Home",
41-
"url": "/",
42-
},
43-
{
44-
"name": "About",
45-
"url": "/about",
46-
},
47-
]
48-
49-
NAV_MENU_RIGHT = [
50-
{
51-
"name": "Login",
52-
"url": "login_url_view", # reversible
53-
"validators": ["menu_generator.validators.is_anonymous"],
54-
},
55-
{
56-
"name": "Register",
57-
"url": "register_view_url", # reversible
58-
"validators": ["menu_generator.validators.is_anonymous"],
59-
},
60-
{
61-
"name": "Account",
62-
"url": "/acount",
63-
"validators": ["menu_generator.validators.is_authenticated"],
64-
"submenu": [
65-
{
66-
"name": "Profile",
67-
"url": "/account/profile",
68-
},
69-
{
70-
"name": "Account Balance",
71-
"url": "/account/balance",
72-
"validators": ["myapp.profiles.is_paid_user"],
73-
},
74-
{
75-
"name": "Account Secrets",
76-
"url": "/account/secrets",
77-
"validators": ["menu_generator.validators.is_superuser"],
78-
}
79-
],
80-
},
81-
]
82-
83-
FOOTER_MENU_LEFT = [
84-
{
85-
"name": "Facebook",
86-
"url": "facebook.com/foobar",
87-
},
88-
{
89-
"name": "Contact US",
90-
"url": "/contact",
91-
},
92-
]
93-
94-
FOOTER_MENU_RIGHT = [
95-
{
96-
"name": "Address",
97-
"url": "/address",
98-
},
99-
]
100-
```
8+
A productivity tool that enables the generation of full featured menus through python list dictionaries, 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
9+
10+
## Features:
11+
12+
- Tested support to Python 2.7, 3.4, 3.5, 3.6
13+
- Tested support to Django 1.8.18, 1.9.13, 1.10.7, 1.11
14+
- No database
15+
- Support unlimited menus
16+
- Icons support
17+
- Semi-Automatically identifies the selected item and his breadcrums
18+
- Controls view access through validators (Permissions, Authentications or whatever you want)
19+
20+
## Installation:
21+
22+
You can install it with one of these options:
23+
- easy_install django-menu-generator
24+
- pip install django-menu-generator
25+
- git clone http://github.com/un33k/django-menu-generator
26+
a. cd django-menu-generator
27+
b. run python setup.py
28+
- wget https://github.com/un33k/django-menu-generator/zipball/master
29+
a. unzip the downloaded file
30+
b. cd into django-menu-generator-* directory
31+
c. run python setup.py
32+
33+
## Usage:
34+
35+
1. Install 'django-menu-generator' as per the above instructions.
36+
2. Add 'menu_generator' to your INSTALLED_APPS.
37+
3. Add {% load menu_generator %} to templates that will handle the menus.
38+
39+
```python
40+
####################################################################################
41+
Example: settings.py
42+
####################################################################################
43+
44+
NAV_MENU_LEFT = [
45+
{
46+
"name": "Home",
47+
"url": "/",
48+
},
49+
{
50+
"name": "About",
51+
"url": "/about",
52+
},
53+
]
54+
55+
NAV_MENU_RIGHT = [
56+
{
57+
"name": "Login",
58+
"url": "login_url_view", # reversible
59+
"validators": ["menu_generator.validators.is_anonymous"],
60+
},
61+
{
62+
"name": "Register",
63+
"url": "register_view_url", # reversible
64+
"validators": ["menu_generator.validators.is_anonymous"],
65+
},
66+
{
67+
"name": "Account",
68+
"url": "/acount",
69+
"validators": ["menu_generator.validators.is_authenticated"],
70+
"submenu": [
71+
{
72+
"name": "Profile",
73+
"url": "/account/profile",
74+
},
75+
{
76+
"name": "Account Balance",
77+
"url": "/account/balance",
78+
"validators": ["myapp.profiles.is_paid_user"],
79+
},
80+
{
81+
"name": "Account Secrets",
82+
"url": "/account/secrets",
83+
"validators": ["menu_generator.validators.is_superuser"],
84+
}
85+
],
86+
},
87+
]
88+
89+
FOOTER_MENU_LEFT = [
90+
{
91+
"name": "Facebook",
92+
"url": "facebook.com/foobar",
93+
},
94+
{
95+
"name": "Contact US",
96+
"url": "/contact",
97+
},
98+
]
99+
100+
FOOTER_MENU_RIGHT = [
101+
{
102+
"name": "Address",
103+
"url": "/address",
104+
},
105+
]
106+
```
107+
108+
You can build the menu list dictionaries inside the project apps with ``menus.py`` files, see the docs for more.
101109

102110
Then in your template, load the template tag to generate your menu.
103111

@@ -107,20 +115,20 @@ Then in your template, load the template tag to generate your menu.
107115

108116
<!DOCTYPE html>
109117
<html>
110-
<head><title>Django Menuware</title></head>
118+
<head><title>Django Menu Generator</title></head>
111119
<body>
112120
<!-- NAV BAR Start -->
113121
{% get_menu "NAV_MENU_LEFT" as left_menu %}
114122
<div style="float:left;">
115123
{% for item in left_menu %}
116124
<li class="{% if item.selected %} active {% endif %}">
117-
<a href="{{item.url}}">{{item.name}}</a>
125+
<a href="{{ item.url }}"> <i class="{{ item.icon_class }}"></i> {{ item.name }}</a>
118126
</li>
119127
{% if item.submenu %}
120128
<ul>
121129
{% for menu in item.submenu %}
122130
<li class="{% if menu.selected %} active {% endif %}">
123-
<a href="{{menu.url}}">{{menu.name}}</a>
131+
<a href="{{ menu.url }}">{{ menu.name }}</a>
124132
</li>
125133
{% endfor %}
126134
</ul>
@@ -132,13 +140,13 @@ Then in your template, load the template tag to generate your menu.
132140
<div style="float:right;">
133141
{% for item in right_menu %}
134142
<li class="{% if item.selected %} active {% endif %}">
135-
<a href="{{item.url}}">{{item.name}}</a>
143+
<a href="{{ item.url }}">{{ item.name }}</a>
136144
</li>
137145
{% if item.submenu %}
138146
<ul>
139147
{% for menu in item.submenu %}
140148
<li class="{% if menu.selected %} active {% endif %}">
141-
<a href="{{menu.url}}">{{menu.name}}</a>
149+
<a href="{{ menu.url }}">{{ menu.name }}</a>
142150
</li>
143151
{% endfor %}
144152
</ul>
@@ -162,27 +170,27 @@ Then in your template, load the template tag to generate your menu.
162170
</html>
163171
```
164172

165-
Running the tests
166-
====================
173+
## Running the tests:
167174

168175
To run the tests against the current environment:
169176

170177
python manage.py test
171178

172179

173-
License
174-
====================
180+
## License:
175181

176182
Released under a ([MIT](LICENSE)) license.
177183

184+
## Author and mantainers:
185+
186+
[Milton Lenis](https://github.com/MiltonLn) - [email protected]
187+
188+
## Credits:
189+
190+
I'd like to thank [Val Kneeman][valkneeman-link], the original author of this project under the name 'menuware'
191+
https://github.com/un33k/django-menuware
178192

179-
Version
180-
====================
181-
X.Y.Z Version
182193

183-
`MAJOR` version -- when you make incompatible API changes,
184-
`MINOR` version -- when you add functionality in a backwards-compatible manner, and
185-
`PATCH` version -- when you make backwards-compatible bug fixes.
186194

187195
[status-image]: https://travis-ci.org/RADYConsultores/django-menu-generator.svg?branch=master
188196
[status-link]: https://travis-ci.org/RADYConsultores/django-menu-generator?branch=master
@@ -196,3 +204,5 @@ X.Y.Z Version
196204
[download-image]: https://img.shields.io/pypi/dm/django-menu-generator.svg
197205
[download-link]: https://pypi.python.org/pypi/django-menu-generator
198206

207+
[valkneeman-link]: https://github.com/un33k
208+

0 commit comments

Comments
 (0)