File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change
1
+ import re
2
+
1
3
from django .conf import settings
2
4
3
- import re
5
+ try :
6
+ from django .apps import apps
7
+ except ImportError :
8
+ apps = False
4
9
5
10
6
11
class Menu (object ):
@@ -47,15 +52,20 @@ def load_menus(c):
47
52
if c .loaded :
48
53
return
49
54
55
+ # Fetch all installed app names
56
+ app_names = settings .INSTALLED_APPS
57
+ if apps :
58
+ app_names = [app_config .name for app_config in apps .get_app_configs ()]
59
+
50
60
# loop through our INSTALLED_APPS
51
- for app in settings . INSTALLED_APPS :
61
+ for app in app_names :
52
62
# skip any django apps
53
63
if app .startswith ("django." ):
54
64
continue
55
65
56
66
menu_module = '%s.menus' % app
57
67
try :
58
- __import__ (menu_module , fromlist = ["menu" ])
68
+ __import__ (menu_module , fromlist = ["menu" , ])
59
69
except ImportError :
60
70
pass
61
71
You can’t perform that action at this time.
0 commit comments