Django calendar widget in a custom form

后端 未结 5 965
说谎
说谎 2021-01-31 04:25

I am trying to add a calendar date input to one of my forms. There is a wonderful calendar widget that Django uses on its admin pages, but I can\'t figure out how to add it to a

5条回答
  •  爱一瞬间的悲伤
    2021-01-31 04:58

    You can do this by form widget " SelectDateWidget()" like this example:

    class MyForm(forms.Form):
    
            start_date=forms.DateField(widget = forms.SelectDateWidget())
            end_date=forms.DateField(widget = forms.SelectDateWidget())
    

提交回复
热议问题