Commit 3d581e4b authored by Yoshinori Okuji's avatar Yoshinori Okuji

Extra check for DateField if used in ListBox


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2418 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2cf234aa
...@@ -522,3 +522,21 @@ def MultiItemsWidget_render_items(self, field, key, value, REQUEST): ...@@ -522,3 +522,21 @@ def MultiItemsWidget_render_items(self, field, key, value, REQUEST):
MultiItemsWidget.render_items = MultiItemsWidget_render_items MultiItemsWidget.render_items = MultiItemsWidget_render_items
# JPS - Subfield handling with listbox requires extension
from Products.Formulator.StandardFields import DateTimeField
class PatchedDateTimeField(DateTimeField):
def _get_default(self, key, value, REQUEST):
if value is not None:
return value
# if there is something in the request then return None
# sub fields should pick up defaults themselves
if REQUEST is not None and hasattr(REQUEST, 'form') and \
REQUEST.form.has_key('subfield_%s_%s' % (self.id, 'year')):
return None
else:
return self.get_value('default')
DateTimeField._get_default = PatchedDateTimeField._get_default
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment