The Entity object should also have a to_json method.

This commit is contained in:
Fabio Manganiello 2023-03-12 23:01:51 +01:00
parent 4a8da80c7c
commit 4bc61133c5
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -138,6 +138,12 @@ if 'entity' not in Base.metadata:
def to_dict(self) -> dict: def to_dict(self) -> dict:
return {col.key: self._serialize_value(col) for col in self.columns} 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): def __repr__(self):
""" """
Same as :meth:`.__str__`. Same as :meth:`.__str__`.