Reputation: 4710
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?
Upvotes: 0
Views: 140
Reputation: 19578
range should be a tuple of datetime objects not strings, check the reference: https://docs.djangoproject.com/en/1.6/ref/models/querysets/#range
Upvotes: 1