EquationForm¶
-
class
EquationForm
(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, instance=None, use_required_attribute=None, renderer=None)[source]¶ Inputs which are used in the Equation editing dialog.
Attributes Summary
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
use_required_attribute
Methods Summary
Update the content of self._errors.
Add a ‘initial’ prefix for checking dynamic initial values.
Return the field name with a prefix appended, if this Form has a prefix set.
Return this form rendered as HTML <p>s.
Return this form rendered as HTML <tr>s – excluding the <table></table>.
Return this form rendered as HTML <li>s – excluding the <ul></ul>.
Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field.
Clean all of self.data and populate self._errors and self.cleaned_data.
Return initial data for field on form.
Return True if data differs from initial.
Return a list of all the BoundField objects that are hidden fields.
Return True if the form needs to be multipart-encoded, i.e. it has FileInput, or False otherwise.
Return True if the form has no errors, or False otherwise.
Return an ErrorList of errors that aren’t associated with a particular field – i.e., from Form.clean().
Rearrange the fields according to field_order.
Save this form’s self.instance object if commit=True.
Call the instance’s validate_unique() method and update the form’s validation errors if any were raised.
Return a list of BoundField objects that aren’t hidden fields.
Methods Documentation
-
add_error
(field, error)¶ Update the content of self._errors.
The field argument is the name of the field to which the errors should be added. If it’s None, treat the errors as NON_FIELD_ERRORS.
The error argument can be a single error, a list of errors, or a dictionary that maps field names to lists of errors. An “error” can be either a simple string or an instance of ValidationError with its message attribute set and a “list or dictionary” can be an actual list or dict or an instance of ValidationError with its error_list or error_dict attribute set.
If error is a dictionary, the field argument must be None and errors will be added to the fields that correspond to the keys of the dictionary.
-
add_initial_prefix
(field_name)¶ Add a ‘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.
Subclasses may wish to override.
-
as_p
()¶ Return this form rendered as HTML <p>s.
-
as_table
()¶ Return this form rendered as HTML <tr>s – excluding the <table></table>.
-
as_ul
()¶ Return this form rendered as HTML <li>s – excluding the <ul></ul>.
-
clean
()¶ Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.
-
full_clean
()¶ Clean all of self.data and populate self._errors and self.cleaned_data.
-
get_initial_for_field
(field, field_name)¶ Return initial data for field on form. Use initial data from the form or the field, in that order. Evaluate callable values.
-
has_changed
()¶ Return True if data differs from initial.
-
has_error
(field, code=None)¶
Return a list of all the BoundField objects that are hidden fields. Useful for manual form layout in templates.
-
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(). Return an empty ErrorList if there are none.
-
order_fields
(field_order)¶ Rearrange the fields according to field_order.
field_order is a list of field names specifying the order. Append fields not included in the list in the default order for backward compatibility with subclasses not overriding field_order. If field_order is None, keep all fields in the order defined in the class. Ignore unknown fields in field_order to allow disabling fields in form subclasses without redefining ordering.
-
save
(commit=True)¶ Save this form’s self.instance object if commit=True. Otherwise, add a save_m2m() method to the form which can be called after the instance is saved manually at a later time. Return the model instance.
-
validate_unique
()¶ Call the instance’s validate_unique() method and update the form’s validation errors if any were raised.
-
visible_fields
()¶ Return a list of BoundField objects that aren’t hidden fields. The opposite of the hidden_fields() method.
-