I'm passing multiple argument in a filter, but when I try to pass date range it's not working, and showing an error : I wrote the following code for that:
where_con = {}
for k in model_k_j:
type_val = type(model_k_j[k])
if type_val== dict:
print "dictonary type"
where_con[k] = medical_home_last_visit__range=["2012-1-1","2013-11-21" ]
else:
col_name.append(k)
where_con[k] = model_k_j[k]
# **where_con {unpack tuple}
print where_con
qs_new = model_obj.objects.filter(**where_con)
Can you suggest what is wrong in that?
范围应该是日期时间对象的元组而不是字符串,请检查引用: https : //docs.djangoproject.com/en/1.6/ref/models/querysets/#range
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.