在rest_framework中序列化DateField的时候出现错误
AssertionError: Expected a `date`, but got a `datetime`. Refusing to coerce, as this may mean losing timezone information. Use a custom read-only field and deal with timezone issues expli
citly.
models.DateField(“创建日期”, default = timezone.now)改成以下代码 解决
import datetime
create_date = models.DateField("创建日期", default =datetime.date.today())