1from django import forms
2from bootstrap_daterangepicker import widgets, fields
3
4
5class DemoForm(forms.Form):
6 # Date Picker Fields
7 date_single_normal = fields.DateField()
8 date_single_with_format = fields.DateField(
9 input_formats=['%d/%m/%Y'],
10 widget=widgets.DatePickerWidget(
11 format='%d/%m/%Y'
12 )
13 )
14 date_single_clearable = fields.DateField(required=False)
15
16 # Date Range Fields
17 date_range_normal = fields.DateRangeField()
18 date_range_with_format = fields.DateRangeField(
19 input_formats=['%d/%m/%Y'],
20 widget=widgets.DateRangeWidget(
21 format='%d/%m/%Y'
22 )
23 )
24 date_range_clearable = fields.DateRangeField(required=False)
25
26 # DateTime Range Fields
27 datetime_range_normal = fields.DateTimeRangeField()
28 datetime_range_with_format = fields.DateTimeRangeField(
29 input_formats=['%d/%m/%Y (%I:%M:%S)'],
30 widget=widgets.DateTimeRangeWidget(
31 format='%d/%m/%Y (%I:%M:%S)'
32 )
33 )
34 datetime_range_clearable = fields.DateTimeRangeField(required=False)
35