[Fixed]-How can I use a calendar visual widget in django form?

1👍

Are you sure your date column has the .vDateField class? Try adding the class to the column:

class FormA(forms.ModelForm):

    def __init__(self, *args, **kwargs):
        super(FormA, self).__init__(*args, **kwargs)
        # Making name required
        self.fields['date'].required = False
        # Adding .vDateField class
        self.fields['date'].widget.attrs = {'class': 'vDateField'}

    class Meta:
        model = Ensaioa
👤César

Leave a comment