This commit is contained in:
huangsong
2022-01-18 15:54:21 +08:00
parent bf6ee9ce35
commit 51606a6321
2 changed files with 4 additions and 1 deletions

View File

@ -17,10 +17,12 @@ if TYPE_CHECKING: # pragma no cover
from ormar import Model, BaseField
def to_str(val: Union[bytes, str]):
def to_str(val: Union[bytes, str, int]):
""" convert bytes to str simply """
if isinstance(val, bytes):
return val.decode("utf-8")
elif isinstance(val, str):
return val
return str(val)