簡體   English   中英

在django中設置了對象查詢的過濾器中具有日期范圍的多人廣告?

[英]mutiple arugment with date range in filter with object query set in django?

我在過濾器中傳遞了多個參數,但是當我嘗試傳遞日期范圍時,它不起作用,並顯示錯誤:為此我編寫了以下代碼:

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)

您能提出什么錯誤嗎?

范圍應該是日期時間對象的元組而不是字符串,請檢查引用: https : //docs.djangoproject.com/en/1.6/ref/models/querysets/#range

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM