Commits

pahaz committed 9b6c2b8

Add new tags ``field_type`` and ``widget_type``

Add new tags ``field_type`` and ``widget_type``

  • Participants
  • Parent commits 976396d

Comments (0)

Files changed (1)

widget_tweaks/templatetags/widget_tweaks.py

         for k, v in self.append_attrs:
             bounded_field = append_attr(bounded_field, '%s:%s' % (k,v.resolve(context)))
         return bounded_field
+
+@register.filter(name='field_type')
+def field_type(value):
+    return value.field.__class__.__name__.lower()
+
+@register.filter(name='widget_type')
+def widget_type(value):
+    return value.field.widget.__class__.__name__.lower()