toolware/templatetags/forms.py
def trim_form(parser, token):
    """
        Returns a form that only contains a subset of the original fields (opcode: incude/exclude fields)
        Exampel:
            <fieldset>
                <legend>Business Info</legend>
                <ul>
                {% trim_form orig_form fields biz_name,biz_city,biz_email,biz_phone as new_form %}
                {{ new_form.as_ul }}
                </ul>
            </fieldset>
            OR:
            <fieldset>
                <legend>Business Info</legend>
                <ul>
                {% trim_form orig_form exclude biz_country,biz_url as new_form %}
                {{ new_form.as_ul }}
                </ul>
            </fieldset>
    """
    try:
        trim_form, orig_form, opcode, fields, as_, new_form = token.split_contents()
    except ValueError:
        raise template.TemplateSyntaxError('Invalid arguments for %r' % token.split_contents()[0])

    return FieldSetNode(opcode, fields.split(','), orig_form, new_form)
def trim_form(parser, token):
    """
        Returns a form that only contains a subset of the original fields (opcode: incude/exclude fields)
        Exampel:
            <fieldset>
                <legend>Business Info</legend>
                <ul>
                {% trim_form orig_form fields biz_name,biz_city,biz_email,biz_phone as new_form %}
                {{ new_form.as_ul }}
                </ul>
            </fieldset>
            OR:
            <fieldset>
                <legend>Business Info</legend>
                <ul>
                {% trim_form orig_form exclude biz_country,biz_url as new_form %}
                {{ new_form.as_ul }}
                </ul>
            </fieldset>
    """
    try:
        trim_form, orig_form, opcode, fields, as_, new_form = token.split_contents()
    except ValueError:
        raise template.TemplateSyntaxError('Invalid arguments for %r' % token.split_contents()[0])

    return FieldSetNode(opcode, fields.split(','), orig_form, new_form)
def trim_form ( parser , token ) : try : trim_form , orig_form , opcode , fields , as_ , new_form = token . split_contents ( ) except ValueError : raise template . TemplateSyntaxError ( 'Invalid arguments for %r' % token . split_contents ( ) [ 0 ] ) return FieldSetNode ( opcode , fields . split ( ',' ) , orig_form , new_form )
Returns a form that only contains a subset of the original fields (opcode: incude/exclude fields)
        Exampel:
            <fieldset>
                <legend>Business Info</legend>
                <ul>
                {% trim_form orig_form fields biz_name,biz_city,biz_email,biz_phone as new_form %}
                {{ new_form.as_ul }}
                </ul>
            </fieldset>
            OR:
            <fieldset>
                <legend>Business Info</legend>
                <ul>
                {% trim_form orig_form exclude biz_country,biz_url as new_form %}
                {{ new_form.as_ul }}
                </ul>
            </fieldset>
Returns a form that only contains a subset of the original fields ( opcode : incude / exclude fields ) Exampel : <fieldset > <legend > Business Info< / legend > <ul > { % trim_form orig_form fields biz_name biz_city biz_email biz_phone as new_form % } {{ new_form . as_ul }} < / ul > < / fieldset > OR : <fieldset > <legend > Business Info< / legend > <ul > { % trim_form orig_form exclude biz_country biz_url as new_form % } {{ new_form . as_ul }} < / ul > < / fieldset >