basic_pages.views.ContactForm

class basic_pages.views.ContactForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]

A Django form class for handling contact information.

Attributes:

email (forms.EmailField): A required field for the user’s email address. subject (forms.CharField): A required field for the message subject. message (forms.CharField): A required field for the message body, using a Textarea widget.

__init__(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)

Methods

__init__([data, files, auto_id, prefix, ...])

add_error(field, error)

Update the content of self._errors.

add_initial_prefix(field_name)

Add an 'initial' prefix for checking dynamic initial values.

add_prefix(field_name)

Return the field name with a prefix appended, if this Form has a prefix set.

as_div()

Render as <div> elements.

as_p()

Render as <p> elements.

as_table()

Render as <tr> elements excluding the surrounding <table> tag.

as_ul()

Render as <li> elements excluding the surrounding <ul> tag.

clean()

Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field.

full_clean()

Clean all of self.data and populate self._errors and self.cleaned_data.

get_context()

get_initial_for_field(field, field_name)

Return initial data for field on form.

has_changed()

Return True if data differs from initial.

has_error(field[, code])

hidden_fields()

Return a list of all the BoundField objects that are hidden fields.

is_multipart()

Return True if the form needs to be multipart-encoded, i.e. it has FileInput, or False otherwise.

is_valid()

Return True if the form has no errors, or False otherwise.

non_field_errors()

Return an ErrorList of errors that aren't associated with a particular field -- i.e., from Form.clean().

order_fields(field_order)

Rearrange the fields according to field_order.

render([template_name, context, renderer])

visible_fields()

Return a list of BoundField objects that aren't hidden fields.

Attributes

base_fields

changed_data

declared_fields

default_renderer

errors

Return an ErrorDict for the data provided for the form.

field_order

media

Return all media required to render the widgets on this form.

prefix

template_name

template_name_div

template_name_label

template_name_p

template_name_table

template_name_ul

use_required_attribute