Skip to content

Commit dfaf228

Browse files
authored
Merge pull request #167 from vsipchenko/master
fix: get_python_type_parse add uuid handler
2 parents 64bae66 + 69f8851 commit dfaf228

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

fastapi_amis_admin/crud/parser.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import datetime
22
from functools import lru_cache
33
from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Type, TypeVar, Union
4+
from uuid import UUID
45

56
import sqlalchemy
67
from fastapi.utils import create_cloned_field, create_response_field
@@ -247,6 +248,8 @@ def filter_modelfield(
247248
def get_python_type_parse(field: Union[InstrumentedAttribute, Column, Label]) -> Callable:
248249
try:
249250
python_type = field.expression.type.python_type
251+
if issubclass(python_type, UUID):
252+
return str
250253
if issubclass(python_type, datetime.date):
251254
if issubclass(python_type, datetime.datetime):
252255
return parse_datetime

0 commit comments

Comments
 (0)