在测试中,您将日期设置为字符串:
mcr = MonthControlRecord(employee=employee, first_day_of_month="2015-12-01")
尝试将其设置为日期:
your_date = datetime.date(2015, 12, 1) mcr = MonthControlRecord(employee=employee, first_day_of_month=your_date)