class documentation

class BoundField:

View In Hierarchy

A Field plus data
Method __bool__ Undocumented
Method __getitem__ Undocumented
Method __init__ Undocumented
Method __iter__ Undocumented
Method __len__ Undocumented
Method __str__ Render this field as an HTML widget.
Method ​_has​_changed Undocumented
Method as​_hidden Return a string of HTML for representing this as an <input type="hidden">.
Method as​_text Return a string of HTML for representing this as an <input type="text">.
Method as​_textarea Return a string of HTML for representing this as a <textarea>.
Method as​_widget Render the field by rendering the passed widget, adding any HTML attributes passed as attrs. If a widget isn't specified, use the field's default widget.
Method build​_widget​_attrs Undocumented
Method css​_classes Return a string of space-separated CSS classes for this field.
Method label​_tag Wrap the given contents in a <label>, if the field has an ID attribute. contents should be mark_safe'd to avoid HTML escaping. If contents aren't given, use the field's HTML-escaped label.
Method value Return the value for this BoundField, using the initial value if the form is not bound or the data otherwise.
Instance Variable field Undocumented
Instance Variable form Undocumented
Instance Variable help​_text Undocumented
Instance Variable html​_initial​_id Undocumented
Instance Variable html​_initial​_name Undocumented
Instance Variable html​_name Undocumented
Instance Variable label Undocumented
Instance Variable name Undocumented
Property auto​_id Calculate and return the ID attribute for this BoundField, if the associated Form has specified auto_id. Return an empty string otherwise.
Property data Return the data for this BoundField, or None if it wasn't given.
Property errors Return an ErrorList (empty if there are no errors) for this field.
Property id​_for​_label Wrapper around the field widget's id_for_label method. Useful, for example, for focusing on this field regardless of whether it has a single widget or a MultiWidget.
Property initial Undocumented
Property is​_hidden Return True if this BoundField's widget is hidden.
Property subwidgets Most widgets yield a single subwidget, but others like RadioSelect and CheckboxSelectMultiple produce one subwidget for each choice.
Property widget​_type Undocumented
def __bool__(self):

Undocumented

def __getitem__(self, idx):

Undocumented

def __init__(self, form, field, name):

Undocumented

def __iter__(self):

Undocumented

def __len__(self):

Undocumented

def __str__(self):
Render this field as an HTML widget.
def _has_changed(self):

Undocumented

def as_hidden(self, attrs=None, **kwargs):
Return a string of HTML for representing this as an <input type="hidden">.
def as_text(self, attrs=None, **kwargs):
Return a string of HTML for representing this as an <input type="text">.
def as_textarea(self, attrs=None, **kwargs):
Return a string of HTML for representing this as a <textarea>.
def as_widget(self, widget=None, attrs=None, only_initial=False):
Render the field by rendering the passed widget, adding any HTML attributes passed as attrs. If a widget isn't specified, use the field's default widget.
def build_widget_attrs(self, attrs, widget=None):

Undocumented

def css_classes(self, extra_classes=None):
Return a string of space-separated CSS classes for this field.
def label_tag(self, contents=None, attrs=None, label_suffix=None):

Wrap the given contents in a <label>, if the field has an ID attribute. contents should be mark_safe'd to avoid HTML escaping. If contents aren't given, use the field's HTML-escaped label.

If attrs are given, use them as HTML attributes on the <label> tag.

label_suffix overrides the form's label_suffix.

def value(self):
Return the value for this BoundField, using the initial value if the form is not bound or the data otherwise.
field =

Undocumented

form =

Undocumented

help_text =

Undocumented

html_initial_id =

Undocumented

html_initial_name =

Undocumented

html_name =

Undocumented

label =

Undocumented

name =

Undocumented

@property
auto_id =
Calculate and return the ID attribute for this BoundField, if the associated Form has specified auto_id. Return an empty string otherwise.
@property
data =
Return the data for this BoundField, or None if it wasn't given.
@property
errors =
Return an ErrorList (empty if there are no errors) for this field.
@property
id_for_label =
Wrapper around the field widget's id_for_label method. Useful, for example, for focusing on this field regardless of whether it has a single widget or a MultiWidget.
@cached_property
initial =

Undocumented

@property
is_hidden =
Return True if this BoundField's widget is hidden.
@cached_property
subwidgets =

Most widgets yield a single subwidget, but others like RadioSelect and CheckboxSelectMultiple produce one subwidget for each choice.

This property is cached so that only one database query occurs when rendering ModelChoiceFields.

@property
widget_type =

Undocumented