Fixed documentation of Widget.id_for_label() empty return value.

This commit is contained in:
Swann 2022-01-06 15:34:31 -05:00 committed by Mariusz Felisiak
parent 286e7d076c
commit d0863429a3
2 changed files with 4 additions and 3 deletions

View File

@ -301,8 +301,8 @@ class Widget(metaclass=MediaDefiningClass):
def id_for_label(self, id_): def id_for_label(self, id_):
""" """
Return the HTML ID attribute of this Widget for use by a <label>, Return the HTML ID attribute of this Widget for use by a <label>, given
given the ID of the field. Return None if no ID is available. the ID of the field. Return an empty string if no ID is available.
This hook is necessary because some widgets have multiple HTML This hook is necessary because some widgets have multiple HTML
elements and, thus, multiple IDs. In that case, this method should elements and, thus, multiple IDs. In that case, this method should

View File

@ -277,7 +277,8 @@ foundation for custom widgets.
.. method:: id_for_label(id_) .. method:: id_for_label(id_)
Returns the HTML ID attribute of this widget for use by a ``<label>``, 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. given the ID of the field. Returns an empty string if an ID isn't
available.
This hook is necessary because some widgets have multiple HTML This hook is necessary because some widgets have multiple HTML
elements and, thus, multiple IDs. In that case, this method should elements and, thus, multiple IDs. In that case, this method should