【发布时间】:2020-09-03 10:53:18
【问题描述】:
我正在尝试将日期字段设置为固定日期。我的带有日期字段的“models.py”:
class Foo(models.Model):
bar = models.DateField()
在我看来:
import datetime
from app.models import Foo
foo = Foo(bar=datetime.date('1/1/2021'))
错误:
Exception Type: TypeError
Exception Value: an integer is required (got type str)
【问题讨论】:
标签: python python-3.x django django-models