categories.admin.NullTreeNodeChoiceField
NullTreeNodeChoiceField#
- class categories.admin.NullTreeNodeChoiceField(level_indicator='---', *args, **kwargs)[source]#
A ModelChoiceField for tree nodes.
Methods
bound_data(data, initial)Return the value that should be shown for this field on render of a bound form, given the submitted POST data for the field and the initial data, if any.
clean(value)Validate the given value and return its "cleaned" value as an appropriate Python object.
get_bound_field(form, field_name)Return a BoundField instance that will be used when accessing the form field in a template.
get_limit_choices_to()Return
limit_choices_tofor this form field.has_changed(initial, data)Return True if data differs from initial.
label_from_instance(obj)Creates labels which represent the tree level of each node when generating option labels.
prepare_value(value)run_validators(value)to_python(value)Return a string.
valid_value(value)Check to see if the provided value is a valid choice.
validate(value)Validate that the input is in self.choices.
widget_attrs(widget)Given a Widget instance (not a Widget class), return a dictionary of any HTML attributes that should be added to the Widget, based on this Field.
Attributes
choicesdefault_error_messagesdefault_validatorsempty_valuesqueryset