Django form.as_p DateField not showing input type as date

前端 未结 7 1271
野性不改
野性不改 2020-12-08 08:45

Working on my first django app, and I have a model defined with some DateFields, and then a ModelForm off of that model i.e.

models

7条回答
  •  爱一瞬间的悲伤
    2020-12-08 09:05

    Installation

    • Run pip install django-datetimepicker
    • Add 'datetimepicker' to your INSTALLED_APPS

    Basic usage

    Here is an example of how to use the widget.

    . Assign the DateTimePicker to a DateTimeField, DateField or TimeField.

    from django import forms
    from datetimepicker.widgets import DateTimePicker
    
    
    class SampleForm(forms.Form):
         datetime = forms.DateTimeField(widget=DateTimePicker(),)
    

提交回复
热议问题