@@ -95,61 +95,87 @@ CUSTOM MENU
95
95
-----------
96
96
97
97
By default JET displays all applications and it models in the side menu in the alphabetical order.
98
- To display applications and models you want or to change their order you can use ``JET_SIDE_MENU_CUSTOM_APPS `` setting.
98
+ To display applications and models you want or to change their order you can use ``JET_SIDE_MENU_ITEMS `` setting.
99
99
100
100
.. code :: python
101
101
102
- JET_SIDE_MENU_CUSTOM_APPS = [
103
- (' core' , [ # Each list element is a tuple with application name (app_label) and list of models
104
- ' User' ,
105
- ' MenuItem' ,
106
- ' Block' ,
107
- ]),
108
- (' shops' , [
109
- ' Shop' ,
110
- ' City' ,
111
- ' MetroStation' ,
112
- ]),
113
- (' feedback' , [
114
- ' Feedback' ,
115
- ]),
102
+ JET_SIDE_MENU_ITEMS = [ # A list of application or custom dicts
103
+ {' label' : _(' General' ), ' app_label' : ' core' , ' models' : [
104
+ {' name' : ' help.question' },
105
+ {' name' : ' pages.page' },
106
+ {' name' : ' city' },
107
+ {' name' : ' validationcode' },
108
+ ]},
109
+ {' label' : _(' Users' ), ' models' : [
110
+ {' name' : ' core.user' },
111
+ {' name' : ' auth.group' },
112
+ {' name' : ' core.userprofile' },
113
+ ]},
114
+ {' app_label' : ' banners' , ' models' : [
115
+ {' name' : ' banner' },
116
+ {' name' : ' bannertype' },
117
+ ]},
118
+ {' app_label' : ' talks' , ' models' : [
119
+ {' name' : ' talk' },
120
+ {' name' : ' talkmessage' },
121
+ ]},
116
122
]
117
123
118
- If want to show all application's models use `` __all__ `` keyword.
124
+ .. deprecated :: 1.0.6
119
125
120
- .. code :: python
126
+ Old way of customizing menu items via `JET_SIDE_MENU_CUSTOM_APPS ` setting is now deprecated in favor
127
+ of new `JET_SIDE_MENU_ITEMS ` setting.
121
128
122
- JET_SIDE_MENU_CUSTOM_APPS = [
123
- (' core' , [' __all__' ]),
124
- ...
125
- ]
129
+ .. code :: python
130
+
131
+ JET_SIDE_MENU_CUSTOM_APPS = [
132
+ (' core' , [ # Each list element is a tuple with application name (app_label) and list of models
133
+ ' User' ,
134
+ ' MenuItem' ,
135
+ ' Block' ,
136
+ ]),
137
+ (' shops' , [
138
+ ' Shop' ,
139
+ ' City' ,
140
+ ' MetroStation' ,
141
+ ]),
142
+ (' feedback' , [
143
+ ' Feedback' ,
144
+ ]),
145
+ ]
126
146
127
147
If have multiple admin sites and you want to specify different menu applications for each admin site, wrap menu lists
128
148
in dictionary with admin site names as keys:
129
149
130
150
.. code :: python
131
151
132
- JET_SIDE_MENU_CUSTOM_APPS = {
152
+ JET_SIDE_MENU_ITEMS = {
133
153
' admin' : [
134
- (' core' , [' __all__' ]),
154
+ {' label' : _(' General' ), ' app_label' : ' core' , ' models' : [
155
+ {' name' : ' help.question' },
156
+ {' name' : ' pages.page' },
157
+ {' name' : ' city' },
158
+ {' name' : ' validationcode' },
159
+ ]},
135
160
...
136
161
],
137
162
' custom_admin' : [
138
- (' custom_admin_app' , [
139
- ' CustomAdminAppModel' ,
140
- ]),
163
+ {' app_label' : ' talks' , ' models' : [
164
+ {' name' : ' talk' },
165
+ {' name' : ' talkmessage' },
166
+ ]},
141
167
...
142
168
]
143
169
}
144
170
145
171
.. note ::
146
172
147
- You can use ``jet_custom_apps_example `` management command to generate example ``JET_SIDE_MENU_CUSTOM_APPS ``
173
+ You can use ``jet_side_menu_items_example `` management command to generate example ``JET_SIDE_MENU_ITEMS ``
148
174
setting which includes all your applications and models. You can use it this way:
149
175
150
176
.. code :: python
151
177
152
- python manage.py jet_custom_apps_example
178
+ python manage.py jet_side_menu_items_example
153
179
154
180
JET_CHANGE_FORM_SIBLING_LINKS
155
181
-----------------------------
0 commit comments