diff options
Diffstat (limited to 'docs/ref/forms')
| -rw-r--r-- | docs/ref/forms/api.txt | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/docs/ref/forms/api.txt b/docs/ref/forms/api.txt index 23fbab9aff..a084867011 100644 --- a/docs/ref/forms/api.txt +++ b/docs/ref/forms/api.txt @@ -972,6 +972,23 @@ Attributes of ``BoundField`` >>> print(f['message'].name) message +.. attribute:: BoundField.widget_type + + .. versionadded:: 3.1 + + Returns the lowercased class name of the wrapped field's widget, with any + trailing ``input`` or ``widget`` removed. This may be used when building + forms where the layout is dependent upon the widget type. For example:: + + {% for field in form %} + {% if field.widget_type == 'checkbox' %} + # render one way + {% else %} + # render another way + {% endif %} + {% endfor %} + + Methods of ``BoundField`` ------------------------- |
