跳至內容
選單
此問題已被標幟
1 回覆
3868 瀏覽次數

What are the steps to reproduce your issue?
I have two fields pnumber (Char)pdate (Date)
when I'm trying to do like this
<field name="pnumber" attrs="{'required': [('pdate', '=', True)]}"/>
What is the current behavior that you observe?
But it is working if I do like this
<field name="pnumber" attrs="{'required': [('pdate', !'=', False)]}"/>
What would be your expected behavior in this case?
It should working in True value also.. as per my view
<field name="pnumber" attrs="{'required': [('pdate', '=', True)]}"/>

頭像
捨棄
最佳答案

You cant check datetime object with true if that has a value. but  in python it will accept that != False,


check this code in your python console

import datetime

x = datetime.date(2012, 9, 1)

if x == True:

     print "fail"

elif x != False or x != True:

     print "truee"


so you can check that using this code


isinstance(x, datetime.date)


Thank You

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
0
2月 25
808
2
10月 24
3730
2
6月 24
2472
1
6月 19
6008
0
3月 15
5206