tags_input.fields module

class tags_input.fields.AdminTagsInputField(queryset, verbose_name=None, *args, **kwargs)[source]

Bases: TagsInputField

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.

For most fields, this will simply be data; FileFields need to handle it a bit differently.

property choices
clean(value)

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

default_error_messages = {'invalid_choice': 'Select a valid choice. %s is not one of the available choices.', 'invalid_pk_value': '"%s" is not a valid value for a primary key.', 'list': 'Enter a list of values.'}
default_validators = []
empty_values = [None, '', [], (), {}]
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_to for this form field.

If it is a callable, invoke it and return the result.

get_mapping()
has_changed(initial, data)

Return True if data differs from initial.

hidden_widget

alias of MultipleHiddenInput

iterator

alias of ModelChoiceIterator

label_from_instance(obj)

Convert objects into strings and generate the labels for the choices presented by this object. Subclasses can override this method to customize the display of the choices.

prepare_value(value)
property queryset
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

alias of AdminTagsInputWidget

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.

class tags_input.fields.TagsInputField(queryset, **kwargs)[source]

Bases: ModelMultipleChoiceField

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.

For most fields, this will simply be data; FileFields need to handle it a bit differently.

property choices
clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

default_error_messages = {'invalid_choice': 'Select a valid choice. %s is not one of the available choices.', 'invalid_pk_value': '"%s" is not a valid value for a primary key.', 'list': 'Enter a list of values.'}
default_validators = []
empty_values = [None, '', [], (), {}]
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_to for this form field.

If it is a callable, invoke it and return the result.

get_mapping()[source]
has_changed(initial, data)

Return True if data differs from initial.

hidden_widget

alias of MultipleHiddenInput

iterator

alias of ModelChoiceIterator

label_from_instance(obj)

Convert objects into strings and generate the labels for the choices presented by this object. Subclasses can override this method to customize the display of the choices.

prepare_value(value)
property queryset
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

alias of TagsInputWidget

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.