Django 2.2 conditional item in SUIT_CONFIG MENU

179 views Asked by At

Django 2.2 django-suit==0.2.26

in my settings.py I have SUIT_CONFIG with MENU inside:

SUIT_CONFIG = {
    # Change Admin header
    'ADMIN_NAME': 'My Name',
    #this controls number of entries in the view on the web page
    'LIST_PER_PAGE': 20,
.......blah-blah......


    # Main Menu manager
    'MENU': (


        {
         'label': 'Label1',
         'url': SCRIPT_NAME + '/some_url1',
        },

        {
         'label': 'Label2', 
         'url': SCRIPT_NAME + '/some_url2',
        },

        {
          'label': 'label3',
          'url': SCRIPT_NAME + '/some_url3/',
        },    
    )    
}

Is it possible to make one of the MENU items optional? Thanks

1

There are 1 answers

0
SwissNavy On

I ended up making the item conditional from the template. The condition is being a superuser and getting this info into settings.py is involved, so I went template way.