Forms¶
-
class
ui.forms.
QueryForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False)[source]¶ -
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 its value is None the errors will be treated 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. What we define as an “error” can be either a simple string or an instance of ValidationError with its message attribute set and what we define as 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)¶ Returns the field name with a prefix appended, if this Form has a prefix set.
Subclasses may wish to override.
-
as_p
()¶ Returns this form rendered as HTML <p>s.
-
as_table
()¶ Returns this form rendered as HTML <tr>s – excluding the <table></table>.
-
as_ul
()¶ Returns this form rendered as HTML <li>s – excluding the <ul></ul>.
-
base_fields
= OrderedDict([('query', <django.forms.fields.CharField object at 0x7fa6cedb5610>)])¶
-
changed_data
¶
-
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__’.
-
declared_fields
= OrderedDict([('query', <django.forms.fields.CharField object at 0x7fa6cedb5610>)])¶
-
errors
¶ Returns an ErrorDict for the data provided for the form
-
full_clean
()¶ Cleans all of self.data and populates self._errors and self.cleaned_data.
-
has_changed
()¶ Returns True if data differs from initial.
-
has_error
(field, code=None)¶
Returns a list of all the BoundField objects that are hidden fields. Useful for manual form layout in templates.
-
is_multipart
()¶ Returns True if the form needs to be multipart-encoded, i.e. it has FileInput. Otherwise, False.
-
is_valid
()¶ Returns True if the form has no errors. Otherwise, False. If errors are being ignored, returns False.
-
media
¶
-
non_field_errors
()¶ Returns an ErrorList of errors that aren’t associated with a particular field – i.e., from Form.clean(). Returns an empty ErrorList if there are none.
-
visible_fields
()¶ Returns a list of BoundField objects that aren’t hidden fields. The opposite of the hidden_fields() method.
-