django-crispy-forms - Django 脆皮表单字段类型日期
问题描述
我正在尝试<input type="date">
在下面的 django 清晰表单布局字段中获取日期选择器功能,例如 HTML。
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')),
)
)
解决方案
推荐阅读
- string - 为什么 golang bytes.Buffer 会这样?
- forms - 带有查询生成器的表单
- python - 进行预测时如何处理未包含在训练集中的标签
- node.js - 渲染返回的 html 代码以显示为视图
- google-cloud-platform - 是否支持 GCP Firestore 原生模式导出到 BQ 导入?
- c++ - 尽管明确说明了返回类型,但对 lambda 的调用是模棱两可的
- c# - 带有十年日历的 DatePicker 仅选择年份
- c# - 如何在 MS Teams 中诱导“查看更多”以获取长 Bot 响应
- c++ - 在 C++ 中对文件中的值分别执行计算
- node.js - 通过 SSL 连接到 mongodb 服务器 v4.0 的问题