Update tempmon UI now that enabled flags are really datetime in DB

This commit is contained in:
Lance Edgar 2019-01-25 19:36:13 -06:00
parent 90e1baef50
commit eb78d79bb3
4 changed files with 75 additions and 22 deletions

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2018 Lance Edgar
# Copyright © 2010-2019 Lance Edgar
#
# This file is part of Rattail.
#
@ -27,6 +27,7 @@ Form Schema Types
from __future__ import unicode_literals, absolute_import
import re
import datetime
import six
@ -63,6 +64,18 @@ class JQueryTime(colander.Time):
return colander.timeparse(cstruct, formats[0])
class DateTimeBoolean(colander.Boolean):
"""
Schema type which presents the user with a "boolean" whereas the underlying
node is really a datetime (assumed to be "naive" UTC, and allow nulls).
"""
def deserialize(self, node, cstruct):
value = super(DateTimeBoolean, self).deserialize(node, cstruct)
if value: # else return None
return datetime.datetime.utcnow()
class GPCType(colander.SchemaType):
"""
Schema type for product GPC data.