【发布时间】:2019-03-20 08:06:10
【问题描述】:
我正在尝试使用 annotate 在我的 Django 查询集中组合日期和时间。
TimesheetEntry.objects.exclude(
timesheet_is_running = False
).filter(
timesheet_users__userprofile__user_company=request.user.userprofile.user_company
).annotate(
timesheet_clock_in_time_date=datetime.datetime.combine('timesheet_clock_in_date', 'timesheet_clock_in_time')
).values_list(
'timesheet_jobs__job_number',
'timesheet_clock_in_time_date',
)
但它给了我TypeError
combine() 参数 1 必须是 datetime.date,而不是 str
【问题讨论】:
标签: django