我正在尝试在下面的 django 脆皮表单布局字段中获得日期选择器功能,例如 HTML <input type="date">
。
Field('invoice_date', type='date'),
然而,它不起作用。完整片段如下:
def __init__(self, *args, **kwargs):
super(InvoiceForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_tag = True
self.helper.form_class = 'form-horizontal'
self.helper.label_class = 'col-md-3 create-label'
self.helper.field_class = 'col-md-9'
self.helper.layout = Layout(
Div(
Field('customer'),
Field('invoice_num'),
Field('invoice_date', type='date'),
Fieldset('Add detail', Formset('details')),
HTML("<br>"),
ButtonHolder(Submit('submit', 'save')),
)
)