(parser, token)
return GetFormFieldTypeNode(field=field, as_var=as_var)
Get form field type.

    Syntax::

        {% get_form_field_type [field] as [context_var_name] %}
    Example::

        {% get_form_field_type form.field as form_field_type %}
        {% if form_field_type.is_checkbox %}
        ...
        {% endif %}
Get form field type.
Get form field type .
def get_form_field_type(parser, token):
    """Get form field type.

    Syntax::

        {% get_form_field_type [field] as [context_var_name] %}
    Example::

        {% get_form_field_type form.field as form_field_type %}
        {% if form_field_type.is_checkbox %}
        ...
        {% endif %}
    """
    bits = token.contents.split()

    if 4 == len(bits):
        if 'as' != bits[-2]:
            raise TemplateSyntaxError(
                "Invalid syntax for {0}. Incorrect number of "
                "arguments.".format(
                    bits[0]
                )
            )
        as_var = bits[-1]
    else:
        raise TemplateSyntaxError(
            "Invalid syntax for {0}. See docs for valid "
            "syntax.".format(bits[0])
        )

    field = parser.compile_filter(bits[1])

    return GetFormFieldTypeNode(field=field, as_var=as_var)
def get_form_field_type ( parser , token ) : bits = token . contents . split ( ) if 4 == len ( bits ) : if 'as' != bits [ - 2 ] : raise TemplateSyntaxError ( "Invalid syntax for {0}. Incorrect number of " "arguments." . format ( bits [ 0 ] ) ) as_var = bits [ - 1 ] else : raise TemplateSyntaxError ( "Invalid syntax for {0}. See docs for valid " "syntax." . format ( bits [ 0 ] ) ) field = parser . compile_filter ( bits [ 1 ] ) return GetFormFieldTypeNode ( field = field , as_var = as_var )