Skip to main content

ModelChoiceIteratorValue

This class acts as a wrapper for model choice values, encapsulating both the raw data value and its associated model instance. It provides standard string representation and equality comparison logic to ensure the object behaves like its underlying value while maintaining access to the source instance.

Attributes

AttributeTypeDescription
valueanyThe primary identifier or database value of the model instance used for form submission and comparison.
instanceobjectThe actual model instance associated with this iterator value, providing access to the full object data.

Constructor

Signature

def ModelChoiceIteratorValue(
value: Any,
instance: Any
) - > null

Parameters

NameTypeDescription
valueAnyThe underlying value of the choice, typically the primary key.
instanceAnyThe model instance associated with this choice value.

Signature

def ModelChoiceIteratorValue(
value: Any,
instance: [Model](../../db/models/base/model.md?sid=django_db_models_base_model)
) - > null

Parameters

NameTypeDescription
valueAnyThe underlying database value or primary key of the model instance.
instance[Model](../../db/models/base/model.md?sid=django_db_models_base_model)The actual Django model instance associated with this choice.