view sat_website/templatetags/utils.py @ 27:eda4deefecd1

reorganisation of the menu using submenus
author souliane <souliane@mailoo.org>
date Wed, 21 Jan 2015 20:07:20 +0100
parents
children b45621706d83
line wrap: on
line source

from django import template
register = template.Library()

@register.filter
def is_tuple(value):
    """Tell if this value is a tuple or not.

    @param value (obj): any object
    @return: True if value is a tuple
    """
    # XXX: we would like to have is_type with an argument instead, but it would
    # rely on a strange comparison - isinstance(value, arg) doesn't work here
    return type(value) == tuple