Commit 56d05f57 authored by Nicolas Delaby's avatar Nicolas Delaby

Use default_now option of DateTime Field

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31069 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 072b4834
......@@ -1276,7 +1276,10 @@ class DateTimeWidget(Widget):
attr_dict = {}
text_node = Element('{%s}%s' % (TEXT_URI, local_name), nsmap=NSMAP)
# get the field value
text_node.text = self.format_value(field, field.get_value('default'), mode='pdf').decode('utf-8')
value = field.get_value('default')
if not value and field.get_value('default_now'):
value = DateTime()
text_node.text = self.format_value(field, value, mode='pdf').decode('utf-8')
text_node.attrib.update(attr_dict)
if as_string:
return etree.tostring(text_node)
......
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