forms.Widget.id_for_label()

id_for_label(self, id_) [source]

Returns the HTML ID attribute of this widget for use by a <label>, given the ID of the field. Returns None if an ID isn’t available.

This hook is necessary because some widgets have multiple HTML elements and, thus, multiple IDs. In that case, this method should return an ID value that corresponds to the first ID in the widget’s tags.

doc_Django
2016-10-09 18:37:12
Comments
Leave a Comment

Please login to continue.