电脑端效果:
models.py
class Order(models.Model): send_time = models.DateTimeField(verbose_name="发送时间", null=True, blank=True)
forms.py
class OrderForm(forms.ModelForm): send_time = forms.DateTimeField(label='发送时间', input_formats=['%Y-%m-%dT%H:%M'], widget=forms.DateInput(attrs={'type':'datetime-local'})) class Meta: exclude = [] model = Order
view.py
def get(request, *args, **kwargs): form = OrderForm(instance=None) return render(request, 'index.html', locals())
标签:form,py,Django,forms,datetime,local,class From: https://www.cnblogs.com/chaoqi/p/17165094.html