DateTimeWidgetContextMixin
This mixin provides a standardized way to enhance the context of date and time widgets by automatically associating them with a timezone warning help text. It modifies the widget's attributes to include an ARIA description, ensuring that accessibility metadata is consistently applied across form fields.
Methods
get_context()
@classmethod
def get_context(
name: str,
value: any,
attrs: dict
) - > dict
Extends the widget context to include an ARIA accessibility attribute that links the input to a timezone warning help text element.
Parameters
| Name | Type | Description |
|---|---|---|
| name | str | The name of the form field used to generate the unique ID for the timezone warning help text. |
| value | any | The current value of the widget to be rendered in the template context. |
| attrs | dict | A dictionary of HTML attributes to be applied to the rendered widget element. |
Returns
| Type | Description |
|---|---|
dict | A dictionary containing the template context for rendering the widget, including the updated aria-describedby attribute. |