AdminSplitDateTime
A SplitDateTime Widget that has some admin-specific styling.
Attributes
| Attribute | Type | Description |
|---|---|---|
| template_name | string = admin/widgets/split_datetime.html | The path to the HTML template used to render the split date and time input fields with admin-specific styling. |
Constructor
Signature
def AdminSplitDateTime(
attrs: dict = None
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| attrs | dict = None | Optional dictionary of HTML attributes to be added to the rendered widget. |
Signature
def AdminSplitDateTime(
attrs: dict = null
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| attrs | dict = null | A dictionary containing HTML attributes to be applied to the rendered widget. |
Methods
get_context()
@classmethod
def get_context(
name: string,
value: any,
attrs: dict
) - > dict
Builds the template context for rendering the widget, adding localized labels for date and time and setting ARIA accessibility attributes for sub-widgets.
Parameters
| Name | Type | Description |
|---|---|---|
| name | string | The name of the form field associated with this widget. |
| value | any | The current value of the field to be displayed in the widget. |
| attrs | dict | Additional HTML attributes to be merged into the widget's final output. |
Returns
| Type | Description |
|---|---|
dict | A dictionary containing the context data used to render the widget template, including sub-widget configurations and labels. |
id_for_label()
@classmethod
def id_for_label(
id_: string
) - > string
Returns the HTML ID of the widget for use in label tags, ensuring the label points to the primary container ID.
Parameters
| Name | Type | Description |
|---|---|---|
| id_ | string | The base HTML ID assigned to the widget. |
Returns
| Type | Description |
|---|---|
string | The unmodified ID string used to link a label to the widget. |