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
| Attribute | Type | Description |
|---|---|---|
| value | any | The primary identifier or database value of the model instance used for form submission and comparison. |
| instance | object | The 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
| Name | Type | Description |
|---|---|---|
| value | Any | The underlying value of the choice, typically the primary key. |
| instance | Any | The 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
| Name | Type | Description |
|---|---|---|
| value | Any | The 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. |