mirror of
https://github.com/veops/cmdb.git
synced 2025-08-07 18:58:11 +08:00
fix date picker
This commit is contained in:
@@ -47,8 +47,8 @@ type_map = {
|
||||
Attribute.FLOAT: float,
|
||||
Attribute.TEXT: str,
|
||||
Attribute.TIME: str,
|
||||
Attribute.DATE: lambda x: x.strftime("%Y%m%d"),
|
||||
Attribute.DATETIME: lambda x: x.strftime("%Y%m%d %H:%M:%S"),
|
||||
Attribute.DATE: lambda x: x.strftime("%Y-%m-%d"),
|
||||
Attribute.DATETIME: lambda x: x.strftime("%Y-%m-%d %H:%M:%S"),
|
||||
},
|
||||
'serialize2': {
|
||||
Attribute.INT: int,
|
||||
|
@@ -10,7 +10,9 @@ from api.lib.exception import CommitException
|
||||
|
||||
class FormatMixin(object):
|
||||
def to_dict(self):
|
||||
return dict([(k.name, getattr(self, k.name)) for k in getattr(self, "__table__").columns])
|
||||
return dict([(k.name,
|
||||
getattr(self, k.name) if not isinstance(getattr(self, k.name), datetime.datetime) else getattr(
|
||||
self, k.name).strftime('%Y-%m-%d %H:%M:%S')) for k in getattr(self, "__table__").columns])
|
||||
|
||||
@classmethod
|
||||
def get_columns(cls):
|
||||
@@ -18,7 +20,6 @@ class FormatMixin(object):
|
||||
|
||||
|
||||
class CRUDMixin(FormatMixin):
|
||||
|
||||
@classmethod
|
||||
def create(cls, flush=False, **kwargs):
|
||||
return cls(**kwargs).save(flush=flush)
|
||||
|
Reference in New Issue
Block a user