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

I want to set default date field  January to December and later on i want a field in which user can select any date and that selected will do minus from default field please help me in it.

Here is the default field 

perioud = fields.date() but it is not showing 

 

頭像
捨棄
最佳答案

Hi,

You can set default value for date field like this,

date = fields.Date(required=True, default=fields.Date.context_today)

Thanks

頭像
捨棄

Wrong!!!
AttributeError: type object 'Date' has no attribute 'contxt_today'

yes, wrong in your code ;)

contxt_today --> context_today

相關帖文 回覆 瀏覽次數 活動
2
1月 24
2618
2
6月 22
4561
2
6月 18
6102
2
11月 16
13717
2
2月 24
12608