Open doaa-altarawy opened 6 years ago
"""
Widgets for Flask-Admin forms.
Note: This file has been updated to reference "bootstrap-daterangepicker.js" instead of "bootstrap-datepicker.js."
"""
from flask_admin.form import RenderTemplateWidget
# Example widget using the corrected reference
class DateRangePickerWidget(RenderTemplateWidget):
"""
DateRangePickerWidget
----------------------
A widget that renders a date range picker input field using Bootstrap's `bootstrap-daterangepicker.js`.
This widget is based on the Bootstrap Daterangepicker library and allows users to select date ranges.
"""
def __init__(self):
super().__init__('widgets/daterangepicker.html')
def __call__(self, field, **kwargs):
if 'class' not in kwargs:
kwargs['class'] = 'form-control'
return super().__call__(field, **kwargs)
# Other widgets and code in the file
# ...
# Corrected comments and references throughout the file
# Ensure all occurrences of "bootstrap-datepicker.js" are replaced with "bootstrap-daterangepicker.js"
The docs in multiple locations in flask_admin/form/widgets.py still, reference bootstrap-datepicker.js It should say instead "bootstrap-daterangepicker.js"