@@ -298,6 +298,7 @@ class CommAdminView(BaseAdminView):
298
298
global_models_icon = {}
299
299
default_model_icon = None
300
300
apps_label_title = {}
301
+ apps_icons = {}
301
302
302
303
def get_site_menu (self ):
303
304
return None
@@ -321,6 +322,7 @@ def get_url(https://github.com/menu,%20had_urls):
321
322
if getattr (model_admin , 'hidden_menu' , False ):
322
323
continue
323
324
app_label = model ._meta .app_label
325
+ app_icon = None
324
326
model_dict = {
325
327
'title' : unicode (capfirst (model ._meta .verbose_name_plural )),
326
328
'url' : self .get_model_url (model , "changelist" ),
@@ -349,16 +351,22 @@ def get_url(https://github.com/menu,%20had_urls):
349
351
app_title = getattr (mod , 'verbose_name' )
350
352
elif 'app_title' in dir (mod ):
351
353
app_title = getattr (mod , 'app_title' )
354
+ #find app icon
355
+ if app_label .lower () in self .apps_icons :
356
+ app_icon = self .apps_icons [app_label .lower ()]
352
357
353
358
nav_menu [app_key ] = {
354
359
'title' : app_title ,
355
360
'menus' : [model_dict ],
356
361
}
357
362
358
363
app_menu = nav_menu [app_key ]
359
- if ('first_icon' not in app_menu or
364
+ if app_icon :
365
+ app_menu ['first_icon' ] = app_icon
366
+ elif ('first_icon' not in app_menu or
360
367
app_menu ['first_icon' ] == self .default_model_icon ) and model_dict .get ('icon' ):
361
368
app_menu ['first_icon' ] = model_dict ['icon' ]
369
+
362
370
if 'first_url' not in app_menu and model_dict .get ('url' ):
363
371
app_menu ['first_url' ] = model_dict ['url' ]
364
372
0 commit comments