Django crispy forms field type date

Viewed 147

I am trying to get date picker functionality like HTML <input type="date"> in django crispy form layout field below.

Field('invoice_date', type='date'),

However, its not working. Full snippet below:

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')),
                )
            )
0 Answers
Related