django-suit
django-suit copied to clipboard
Add menu item using if/else condition???
How can I display/add a model to models tuple using inline if else
{'label': 'y', 'url': 'x' } if True else ____???
You'd need to use Python code to construct the tuple from a list e.g.
>>> x = [{'label': 'y', 'url': 'x' }, {'label': 'a', 'url': 'b' }]
>>> a = True
>>> if a:
... x.append({'label': '1', 'url': '2' })
>>> y = tuple(x) # do this after the construction is all finished
https://github.com/darklow/django-suit/issues/693#issuecomment-400397974