def __init__(self, description, default=relativedelta()):
"""
default: may either be provided as a:
* datetime.date object
* string in ISO format (YYYY-mm-dd)
* datetime.timedelta object. The date will be current - delta
* dateutil.relativedelta object. The date will be current - delta
If not specified, it will be the current date.
Note that dateutil is not in the Python standard library. It provides a simpler
API to specify a duration in days, weeks, months, etc. You can install it with pip.
"""
self.description = description
self.default = to_date_model(default)
# see Bootstrap date picker docs for options
# https://bootstrap-datepicker.readthedocs.io/en/stable/#
self.attributes = {
'data-date-format': 'yyyy-mm-dd',
'data-date-orientation': 'left bottom',
'data-date-autoclose': 'true',
'value': self.default.iso(),
}
评论列表
文章目录