File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,9 @@ def get_menu(context, menu_name):
20
20
:param menu_name: String, name of the menu to be found
21
21
:return: Generated menu
22
22
"""
23
- menu_list = getattr (settings , menu_name , defaults .MENU_NOT_FOUND )
23
+ # Instantiate a new list() or else the same instance of the menu_list gets used over and over
24
+ # (and possibly re-adding the menu_from_apps list on each request)
25
+ menu_list = list (getattr (settings , menu_name , defaults .MENU_NOT_FOUND ))
24
26
menu_from_apps = get_menu_from_apps (menu_name )
25
27
# If there isn't a menu on settings but there is menu from apps we built menu from apps
26
28
if menu_list == defaults .MENU_NOT_FOUND and menu_from_apps :
Original file line number Diff line number Diff line change @@ -351,4 +351,14 @@ def test_generate_menu_selected_related_views_submenu(self):
351
351
self .assertEqual (len (nav ), 1 )
352
352
self .assertEqual (nav [0 ]["selected" ], True )
353
353
self .assertEqual (nav [0 ]["submenu" ][0 ]["selected" ], True )
354
- self .assertEqual (nav [0 ]["submenu" ][1 ]["selected" ], False )
354
+ self .assertEqual (nav [0 ]["submenu" ][1 ]["selected" ], False )
355
+
356
+ def test_subsequent_requests (self ):
357
+ self .request .user = TestUser (authenticated = True )
358
+ ctx = {
359
+ 'request' : self .request
360
+ }
361
+ nav1 = get_menu (ctx , 'NAV_MENU' )
362
+ nav2 = get_menu (ctx , 'NAV_MENU' )
363
+ # Both menus should be equal
364
+ self .assertEqual (nav1 , nav2 )
You can’t perform that action at this time.
0 commit comments