categories.admin.CategoryAdminForm
CategoryAdminForm#
- class categories.admin.CategoryAdminForm(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]#
The form for a category in the admin.
Form fields:
parent: Parent (TreeNodeChoiceField)name: Name (CharField)slug: Slug (SlugField)active: Active (BooleanField)thumbnail: Thumbnail (FileField)thumbnail_width: Thumbnail width (IntegerField)thumbnail_height: Thumbnail height (IntegerField)order: Order (IntegerField)alternate_title: Alternate title (CharField)alternate_url: Alternate url (CharField)description: Description (CharField)meta_keywords: Meta keywords (CharField)meta_extra: Meta extra (CharField)
Methods
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_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()Clean the data passed from the admin interface.
clean_alternate_title()Return either the name or alternate title for the category.
clean_slug()Prune and transliterate the slug.
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.
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.
save([commit])Save this form's self.instance object if commit=True.
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.
Attributes
changed_datadefault_renderererrorsReturn an ErrorDict for the data provided for the form.
field_ordermediaReturn all media required to render the widgets on this form.
prefixuse_required_attribute