Wiki

Clone wiki

django-nav / Home

Difference

Main difference with the original version is that ``Nav.conditional`` and ``NavOption.conditional`` can be methods. You can use ``conditional_args`` and ``conditional_kwargs`` to provide extra args if necessary.

from django_nav import Nav

class RandomNav(Nav):
    """ Randomly show this nav """
    conditional_args = ()
    conditional_kwargs = {}
    
    def conditional(self, context, *args, **kwargs):
        import random
        return random.choice([True, False])
        

Updated