Skip to content

Commit

Permalink
Merge pull request #167 from vsipchenko/master
Browse files Browse the repository at this point in the history
fix: get_python_type_parse add uuid handler
  • Loading branch information
amisadmin authored Apr 22, 2024
2 parents 64bae66 + 69f8851 commit dfaf228
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fastapi_amis_admin/crud/parser.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit dfaf228

Please sign in to comment.