mirror of
https://github.com/yweber/lodel2.git
synced 2026-02-03 17:50:12 +01:00
Implement construct data for datetime + bugfix in datahandler base class
- datahandler base class was not supporting default values due to a bug - implements the datetime datahandler construct_data method
This commit is contained in:
parent
ece5029d66
commit
2faeff1ecb
2 changed files with 7 additions and 2 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#-*- coding: utf-8 -*-
|
||||
import warnings
|
||||
import datetime
|
||||
|
||||
from lodel.leapi.datahandlers.base_classes import DataField
|
||||
|
||||
|
|
@ -89,6 +90,10 @@ class DateTime(DataField):
|
|||
error = None
|
||||
return value, error
|
||||
|
||||
def construct_data(self, emcomponent, fname, datas, cur_value):
|
||||
if (self.now_on_create and cur_value is None) or self.now_on_update:
|
||||
return datetime.datetime.now()
|
||||
|
||||
##@brief Data field designed to handle long string
|
||||
class Text(DataField):
|
||||
help = 'A text field (big string)'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue