@register.filter(name='widget_type')
def widget_type(field):
 try:
  return field.field.widget.__class__.__name__.lower()
 except AttributeError:
  return None

@ register . filter ( name = 'widget_type' ) def widget_type ( field ) : try : return field . field . widget . __class__ . __name__ . lower ( ) except AttributeError : return None
return the widget type .