Commits

Max Countryman committed 26cdade

adding field_id to Label __call__ allowing for runtime override

Comments (0)

Files changed (1)

wtforms/fields/core.py

     def __html__(self):
         return self()
 
-    def __call__(self, text=None, **kwargs):
-        kwargs['for'] = self.field_id
+    def __call__(self, field_id=None, text=None, **kwargs):
+        kwargs['for'] = field_id or self.field_id
         attributes = widgets.html_params(**kwargs)
         return widgets.HTMLString(u'<label %s>%s</label>' % (attributes, text or self.text))