class documentation

class BoundField: (source)

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 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 legend_tag Wrap the given contents in a <legend>, 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 use_fieldset Return the value of this BoundField widget's use_fieldset attribute.
Property widget_type Undocumented
Method _has_changed Undocumented
def __bool__(self): (source)

Undocumented

def __getitem__(self, idx): (source)

Undocumented

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

Undocumented

def __iter__(self): (source)

Undocumented

def __len__(self): (source)

Undocumented

def __str__(self): (source)

Render this field as an HTML widget.

def as_hidden(self, attrs=None, **kwargs): (source)

Return a string of HTML for representing this as an <input type="hidden">.

def as_text(self, attrs=None, **kwargs): (source)

Return a string of HTML for representing this as an <input type="text">.

def as_textarea(self, attrs=None, **kwargs): (source)

Return a string of HTML for representing this as a <textarea>.

def as_widget(self, widget=None, attrs=None, only_initial=False): (source)

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): (source)

Undocumented

def css_classes(self, extra_classes=None): (source)

Return a string of space-separated CSS classes for this field.

def label_tag(self, contents=None, attrs=None, label_suffix=None, tag=None): (source)

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 legend_tag(self, contents=None, attrs=None, label_suffix=None): (source)

Wrap the given contents in a <legend>, 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 <legend> tag. label_suffix overrides the form's label_suffix.

def value(self): (source)

Return the value for this BoundField, using the initial value if the form is not bound or the data otherwise.

Undocumented

Undocumented

help_text = (source)

Undocumented

html_initial_id = (source)

Undocumented

html_initial_name = (source)

Undocumented

html_name = (source)

Undocumented

Undocumented

Undocumented

Calculate and return the ID attribute for this BoundField, if the associated Form has specified auto_id. Return an empty string otherwise.

Return the data for this BoundField, or None if it wasn't given.

Return an ErrorList (empty if there are no errors) for this field.

@property
id_for_label = (source)

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.

Undocumented

Return True if this BoundField's widget is hidden.

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
use_fieldset = (source)

Return the value of this BoundField widget's use_fieldset attribute.

@property
widget_type = (source)

Undocumented

def _has_changed(self): (source)

Undocumented