diff --git a/examples/Dockerfile b/examples/Dockerfile new file mode 100644 index 0000000..8d97650 --- /dev/null +++ b/examples/Dockerfile @@ -0,0 +1,9 @@ +FROM python:3 +RUN mkdir -p /src +WORKDIR /src +COPY ../pyproject.toml ../poetry.lock /src/ +RUN pip3 install poetry +ENV POETRY_VIRTUALENVS_CREATE false +RUN poetry install --no-root +COPY . /src + diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml new file mode 100644 index 0000000..e69de29 diff --git a/fastapi_admin/factory.py b/fastapi_admin/factory.py index d4ccbee..56746ca 100644 --- a/fastapi_admin/factory.py +++ b/fastapi_admin/factory.py @@ -273,6 +273,8 @@ class AdminApp(FastAPI): disabled=readonly, description=data_field.get("description"), ) + if field_type == "DecimalField" or field_type == "FloatField": + field.step = "any" field = field.copy(update=menu.attrs.get(name) or {}) fields[name] = field if name in search_fields: diff --git a/fastapi_admin/site.py b/fastapi_admin/site.py index fdf8d66..9b1d149 100644 --- a/fastapi_admin/site.py +++ b/fastapi_admin/site.py @@ -68,7 +68,7 @@ class Field(BaseModel): ref: Optional[str] description: Optional[str] disabled: Optional[bool] = False - step: str = 'any' + step: str = "any" class Resource(BaseModel):