forked from platypush/platypush
The Entity object should also have a to_json
method.
This commit is contained in:
parent
4a8da80c7c
commit
4bc61133c5
1 changed files with 6 additions and 0 deletions
|
@ -138,6 +138,12 @@ if 'entity' not in Base.metadata:
|
|||
def to_dict(self) -> dict:
|
||||
return {col.key: self._serialize_value(col) for col in self.columns}
|
||||
|
||||
def to_json(self) -> dict:
|
||||
"""
|
||||
Alias for :meth:`.to_dict`.
|
||||
"""
|
||||
return self.to_dict()
|
||||
|
||||
def __repr__(self):
|
||||
"""
|
||||
Same as :meth:`.__str__`.
|
||||
|
|
Loading…
Reference in a new issue