djdb/templatetags/djdb_extras.py
def ifincrate(parser, token):
    """
    Renders the block if item is in a crate.
    """
    bits = token.contents.split()
    if len(bits) != 3:
        raise TemplateSyntaxError(
                "ifincrate requires two arguments, the user and the item")
    nodelist_true = parser.parse(('else', 'endifincrate'))
    token = parser.next_token()
    if token.contents == 'else':
        nodelist_false = parser.parse(('endifincrate',))
        parser.delete_first_token()
    else:
        nodelist_false = NodeList()
    return IfInCrate(nodelist_true, nodelist_false, bits[1], bits[2])

    Renders the block if item is in a crate.
    
Renders the block if item is in a crate.
Renders the block if item is in a crate .
def ifincrate(parser, token):
    bits = token.contents.split()
    if len(bits) != 3:
        raise TemplateSyntaxError(
                "ifincrate requires two arguments, the user and the item")
    nodelist_true = parser.parse(('else', 'endifincrate'))
    token = parser.next_token()
    if token.contents == 'else':
        nodelist_false = parser.parse(('endifincrate',))
        parser.delete_first_token()
    else:
        nodelist_false = NodeList()
    return IfInCrate(nodelist_true, nodelist_false, bits[1], bits[2])
def ifincrate ( parser , token ) : bits = token . contents . split ( ) if len ( bits ) != 3 : raise TemplateSyntaxError ( "ifincrate requires two arguments, the user and the item" ) nodelist_true = parser . parse ( ( 'else' , 'endifincrate' ) ) token = parser . next_token ( ) if token . contents == 'else' : nodelist_false = parser . parse ( ( 'endifincrate' , ) ) parser . delete_first_token ( ) else : nodelist_false = NodeList ( ) return IfInCrate ( nodelist_true , nodelist_false , bits [ 1 ] , bits [ 2 ] )
Renders the block if item is in a crate.
Renders the block if item is in a crate .
"""
    Renders the block if item is in a crate.
    """
parser
token