Allow null for FalafelDateTime form fields
This commit is contained in:
parent
9efe767654
commit
44112a3a4b
|
@ -87,7 +87,7 @@ class FalafelDateTime(colander.DateTime):
|
|||
|
||||
def serialize(self, node, appstruct):
|
||||
if not appstruct:
|
||||
return colander.null
|
||||
return {}
|
||||
|
||||
# cant use isinstance; dt subs date
|
||||
if type(appstruct) is datetime.date:
|
||||
|
@ -111,6 +111,9 @@ class FalafelDateTime(colander.DateTime):
|
|||
if not cstruct:
|
||||
return colander.null
|
||||
|
||||
if not cstruct['date'] and not cstruct['time']:
|
||||
return colander.null
|
||||
|
||||
try:
|
||||
date = datetime.datetime.strptime(cstruct['date'], '%Y-%m-%d').date()
|
||||
except:
|
||||
|
|
Loading…
Reference in a new issue