视图.py
st_date, end_date = week_magic(date.today())
cur = connection.cursor()
cur.execute("select myapp_deal.*,CONCAT(myapp_contacts1.first_name,myapp_contacts1.last_name) as full_name from myapp_deal LEFT JOIN myapp_contacts1 on myapp_contacts1.id = myapp_deal.contact_id where myapp_deal.closed_date BETWEEN" '%s' "and" '%s',[st_date] [end_date])
row2=dictfetchall(cur)
cur.close()
data_json = json.dumps(row2, datetime.datetime)
st_date= 2016-01-18
和{
"list indices must be integers, not datetime.date".
如何使用自定义sql在两个日期之间选择数据?在
A有PostgresQL和django 1.7的脏解决方案:
和用法(对于附加了queryset的模型):
^{pr2}$如果查询包含两个表,而这两个表都有“start\u time”列,则可能会出现名称冲突。在
试试这个
相关问题 更多 >
编程相关推荐