Skip to main content

AdminSplitDateTime

A SplitDateTime Widget that has some admin-specific styling.

Attributes

AttributeTypeDescription
template_namestring = admin/widgets/split_datetime.htmlThe 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

NameTypeDescription
attrsdict = NoneOptional dictionary of HTML attributes to be added to the rendered widget.

Signature

def AdminSplitDateTime(
attrs: dict = null
) - > null

Parameters

NameTypeDescription
attrsdict = nullA 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

NameTypeDescription
namestringThe name of the form field associated with this widget.
valueanyThe current value of the field to be displayed in the widget.
attrsdictAdditional HTML attributes to be merged into the widget's final output.

Returns

TypeDescription
dictA 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

NameTypeDescription
id_stringThe base HTML ID assigned to the widget.

Returns

TypeDescription
stringThe unmodified ID string used to link a label to the widget.