NullBooleanSelect
A Select Widget intended to be used with NullBooleanField.
Constructor
Signature
def NullBooleanSelect(
attrs: dict = None
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| attrs | dict = None | Optional dictionary of HTML attributes to be set on the rendered widget. |
Signature
def NullBooleanSelect(
attrs: dict = None
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| attrs | dict = None | A dictionary containing HTML attributes to be rendered on the select element. |
Methods
format_value()
@classmethod
def format_value(
value: any
) - > string
Converts the internal Python value into a string representation suitable for the HTML option tags.
Parameters
| Name | Type | Description |
|---|---|---|
| value | any | The Python boolean, string, or legacy integer-string value to be mapped to a widget choice. |
Returns
| Type | Description |
|---|---|
string | A string value of 'true', 'false', or 'unknown' used to set the selected state in the HTML template. |
value_from_datadict()
@classmethod
def value_from_datadict(
data: dict,
files: dict,
name: string
) - > boolean | null
Extracts and normalizes the value from the submitted form data into a Pythonic boolean or None.
Parameters
| Name | Type | Description |
|---|---|---|
| data | dict | The dictionary of submitted form data, typically request.POST or request.GET. |
| files | dict | The dictionary of uploaded file data. |
| name | string | The name of the form field used as the key to look up the value in the data dictionary. |
Returns
| Type | Description |
|---|---|
| `boolean | null` |