Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
9650 มุมมอง

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

Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ม.ค. 24
2618
2
มิ.ย. 22
4557
2
มิ.ย. 18
6102
2
พ.ย. 16
13717
2
ก.พ. 24
12607