I have something like this working:

sub_menu = []
if (auth.user_id != None) and ((auth.has_membership(role = 'admin'))):
    sub_menu = [('Admin',  False,  URL('admin')), ]
response.menu = [('Home', False, URL('home','default','index'), []),
    (SPAN('Price List',_style='color:yellow'), True, 
URL('pricelist','default','index'), 
    [('Guideline',  False,  URL('pricelist','default','guideline')),
     ('Multiplier Tables',  False, 
 URL('pricelist','default','multitable')),
     ('Cut Charge Tables',  False,  URL('pricelist','default','cuttable')),
     (sub_menu),
    ])]

On Wednesday, April 11, 2012 12:24:29 PM UTC-4, Omi Chiba wrote:
>
> The following menu works. It's add "Admin" menu next to "Price List" if 
> the user has role "admin". Now, I want to add the "Admin" menu as sub-menu 
> of "Price List" where it's right after the "Cut Charge Tables". How can I 
> do this ?
>
> response.menu = [('Home', False, URL('home','default','index'), []),
>     (SPAN('Price List',_style='color:yellow'), True, 
> URL('pricelist','default','index'), 
>     [('Guideline',  False,  URL('pricelist','default','guideline')),
>      ('Multiplier Tables',  False, 
>  URL('pricelist','default','multitable')),
>      ('Cut Charge Tables',  False,  URL('pricelist','default','cuttable')),
>     ])]
>
> if (auth.user_id != None) and ((auth.has_membership(role = 'admin'))):
>     response.menu += [('Admin',  False,  URL('admin')), ]
>

Reply via email to