code: def widget_type(field):
      
      if hasattr(field, 'field') and hasattr(field.field, 'widget') and field.field.widget:
          return field.field.widget.__class__.__name__.lower()
      return ''
docs: Template filter that returns field widget class name (in lower case).
      E.g. if field's widget is TextInput then {{ field|widget_type }} will
      return 'textinput'.