forms.BoundField.label

BoundField.label The label of the field. This is used in label_tag().

forms.BoundField.value()

BoundField.value() [source] Use this method to render the raw value of this field as it would be rendered by a Widget: >>> initial = {'subject': 'welcome'} >>> unbound_form = ContactForm(initial=initial) >>> bound_form = ContactForm(data={'subject': 'hi'}, initial=initial) >>> print(unbound_form['subject'].value()) welcome >>> print(bound_form['subject'].value()) hi

forms.CharField

class CharField(**kwargs) [source] Default widget: TextInput Empty value: '' (an empty string) Normalizes to: A Unicode object. Validates max_length or min_length, if they are provided. Otherwise, all inputs are valid. Error message keys: required, max_length, min_length Has three optional arguments for validation: max_length min_length If provided, these arguments ensure that the string is at most or at least the given length. strip New in Django 1.9. If True (default), t

forms.BoundField.name

BoundField.name The name of this field in the form: >>> f = ContactForm() >>> print(f['subject'].name) subject >>> print(f['message'].name) message

forms.CharField.max_length

max_length

forms.BoundField.label_tag()

BoundField.label_tag(contents=None, attrs=None, label_suffix=None) [source] To separately render the label tag of a form field, you can call its label_tag() method: >>> f = ContactForm(data={'message': ''}) >>> print(f['message'].label_tag()) <label for="id_message">Message:</label> You can provide the contents parameter which will replace the auto-generated label tag. An attrs dictionary may contain additional attributes for the <label> tag. The HTML tha

forms.BoundField.id_for_label

BoundField.id_for_label Use this property to render the ID of this field. For example, if you are manually constructing a <label> in your template (despite the fact that label_tag() will do this for you): <label for="{{ form.my_field.id_for_label }}">...</label>{{ my_field }} By default, this will be the field’s name prefixed by id_ (“id_my_field” for the example above). You may modify the ID by setting attrs on the field’s widget. For example, declaring a field like this:

forms.BoundField.html_name

BoundField.html_name The name that will be used in the widget’s HTML name attribute. It takes the form prefix into account.

forms.BoundField.help_text

BoundField.help_text The help_text of the field.

forms.BoundField.form

BoundField.form The Form instance this BoundField is bound to.