From 69f885127b193c140e137bf8e5c3a9837040a220 Mon Sep 17 00:00:00 2001 From: Vitalii Sipchenko Date: Mon, 15 Apr 2024 16:18:56 +0300 Subject: [PATCH] fix: get_python_type_parse add uuid handler --- fastapi_amis_admin/crud/parser.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fastapi_amis_admin/crud/parser.py b/fastapi_amis_admin/crud/parser.py index 45f7cdf..a29d641 100644 --- a/fastapi_amis_admin/crud/parser.py +++ b/fastapi_amis_admin/crud/parser.py @@ -1,6 +1,7 @@ import datetime from functools import lru_cache from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Type, TypeVar, Union +from uuid import UUID import sqlalchemy from fastapi.utils import create_cloned_field, create_response_field @@ -247,6 +248,8 @@ def filter_modelfield( def get_python_type_parse(field: Union[InstrumentedAttribute, Column, Label]) -> Callable: try: python_type = field.expression.type.python_type + if issubclass(python_type, UUID): + return str if issubclass(python_type, datetime.date): if issubclass(python_type, datetime.datetime): return parse_datetime