add step in Field with DecimalField and FloatField

This commit is contained in:
long2ice
2020-08-17 12:35:19 +08:00
parent 6cbdbcf574
commit 3cd3c10fd4
4 changed files with 12 additions and 1 deletions

9
examples/Dockerfile Normal file
View File

@@ -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

View File

View File

@@ -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:

View File

@@ -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):