diff --git a/src/bootstrap_datepicker_plus/_base.py b/src/bootstrap_datepicker_plus/_base.py index 7e83fe0..30cae46 100644 --- a/src/bootstrap_datepicker_plus/_base.py +++ b/src/bootstrap_datepicker_plus/_base.py @@ -14,8 +14,8 @@ class BasePickerInput(DateTimeBaseInput): """Base Date-Picker input class for widgets of this package.""" variant = WidgetVariant.date + _date_format = "%Y-%m-%d" backend_date_format = "YYYY-MM-DD" - format_key = "DATE_INPUT_FORMATS" options: Optional[WidgetOptions] = None template_name = "bootstrap_datepicker_plus/input.html" @@ -53,7 +53,7 @@ def __init__( self.options, options, ) - super().__init__(attrs) + super().__init__(attrs, self._date_format) def build_attrs( self, base_attrs: InputAttrs, extra_attrs: Optional[InputAttrs] = None diff --git a/src/bootstrap_datepicker_plus/widgets.py b/src/bootstrap_datepicker_plus/widgets.py index 6a686cc..c8f3eef 100644 --- a/src/bootstrap_datepicker_plus/widgets.py +++ b/src/bootstrap_datepicker_plus/widgets.py @@ -21,29 +21,29 @@ class TimePickerInput(BasePickerInput): """Widget to display a Time-Picker Calendar on a TimeField.""" variant = WidgetVariant.time + _date_format = "%H:%M:%S" backend_date_format = "HH:mm:ss" - format_key = "TIME_INPUT_FORMATS" class DateTimePickerInput(BasePickerInput): """Widget to display a DateTime-Picker Calendar on a DateTimeField.""" variant = WidgetVariant.datetime + _date_format = "%Y-%m-%d %H:%M:%S" backend_date_format = "YYYY-MM-DD HH:mm:ss" - format_key = "DATETIME_INPUT_FORMATS" class MonthPickerInput(BasePickerInput): """Widget to display a Month-Picker Calendar on a DateField.""" variant = WidgetVariant.month + _date_format = "%Y-%m-%d" backend_date_format = "YYYY-MM-01" - format_key = "DATE_INPUT_FORMATS" class YearPickerInput(BasePickerInput): """Widget to display a Year-Picker Calendar on a DateField.""" variant = WidgetVariant.year + _date_format = "%Y-%m-%d" backend_date_format = "YYYY-01-01" - format_key = "DATE_INPUT_FORMATS"