Skip to content

Commit 0ff0057

Browse files
authored
Bump frontend. Fix tests. (#45)
Removed pydantic anmd isort from dependencies. Fix linters
1 parent cfc01d1 commit 0ff0057

45 files changed

Lines changed: 3031 additions & 2507 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ jobs:
1010
- name: Set up Python
1111
uses: actions/setup-python@v4
1212
with:
13-
python-version: '3.10'
13+
python-version: '3.12'
1414
cache: "poetry"
1515
- name: Setup Node.js
1616
uses: actions/setup-node@v3
1717
with:
18-
node-version: 18.x
18+
node-version: v22.4.1
1919
cache: 'yarn'
2020
cache-dependency-path: 'frontend/yarn.lock'
2121
- name: Install Dependencies

Makefile

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,6 @@ kill:
4242
@exec kill -9 $$(lsof -t -i:8090)
4343
@exec kill -9 $$(lsof -t -i:3030)
4444

45-
.PHONY: collectstatic
46-
collectstatic:
47-
@exec rm -rf ./fastadmin/static/*.js
48-
@exec rm -rf ./fastadmin/static/*.css
49-
@exec cp -rf ./frontend/dist/assets/index-*.js ./fastadmin/static/main.min.js
50-
@exec cp -rf ./frontend/dist/assets/index-*.css ./fastadmin/static/main.min.css
51-
5245
.PHONY: install
5346
install:
5447
@exec pip install poetry
@@ -63,7 +56,6 @@ docs:
6356
build:
6457
@exec make docs
6558
@exec make -C frontend build
66-
@exec make collectstatic
6759

6860
.PHONY: push
6961
pre-push:

docs/build.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ def get_versions():
110110
"Update packages. Use vite instead obsolete react-scripts.",
111111
],
112112
},
113+
{
114+
"version": "0.2.1",
115+
"changes": [
116+
"Update packages. Fix linters and tests in vite frontend. Removed pydantic from dependencies.",
117+
],
118+
},
113119
]
114120

115121

docs/index.html

Lines changed: 12 additions & 11 deletions
Large diffs are not rendered by default.

examples/dashboard/djangoorm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ class UsersDashboardWidgetAdmin(DashboardWidgetAdmin):
2323
x_field = "date"
2424
y_field = "count"
2525
x_field_filter_widget_type = WidgetType.DatePicker
26-
x_field_filter_widget_props = {"picker": "month"}
27-
x_field_periods = ["day", "week", "month", "year"]
26+
x_field_filter_widget_props = {"picker": "month"} # noqa: RUF012
27+
x_field_periods = ["day", "week", "month", "year"] # noqa: RUF012
2828

2929
def get_data( # type: ignore [override]
3030
self,

examples/dashboard/tortoise.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from datetime import datetime, timedelta, timezone
2+
from typing import Any
23

34
from tortoise import Tortoise, fields
45
from tortoise.models import Model
@@ -23,8 +24,8 @@ class UsersDashboardWidgetAdmin(DashboardWidgetAdmin):
2324
x_field = "date"
2425
y_field = "count"
2526
x_field_filter_widget_type = WidgetType.DatePicker
26-
x_field_filter_widget_props = {"picker": "month"}
27-
x_field_periods = ["day", "week", "month", "year"]
27+
x_field_filter_widget_props: dict[str, Any] = {"picker": "month"} # noqa: RUF012
28+
x_field_periods = ["day", "week", "month", "year"] # noqa: RUF012
2829

2930
async def get_data(
3031
self,
@@ -43,7 +44,7 @@ async def get_data(
4344
else:
4445
max_x_field_date = datetime.fromisoformat(max_x_field.replace("Z", "+00:00"))
4546

46-
if not period_x_field or period_x_field not in self.x_field_periods:
47+
if not period_x_field or period_x_field not in (self.x_field_periods or []):
4748
period_x_field = "month"
4849

4950
results = await conn.execute_query_dict(

examples/inlines/tortoise.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class UserAdmin(TortoiseModelAdmin):
5050
(None, {"fields": ("username", "hash_password")}),
5151
("Permissions", {"fields": ("is_active", "is_superuser")}),
5252
)
53-
formfield_overrides = {
53+
formfield_overrides = { # noqa: RUF012
5454
"username": (WidgetType.SlugInput, {"required": True}),
5555
"password": (WidgetType.PasswordInput, {"passwordModalForm": True}),
5656
}

examples/models/tortoise.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class UserAdmin(TortoiseModelAdmin):
3434
(None, {"fields": ("username", "hash_password")}),
3535
("Permissions", {"fields": ("is_active", "is_superuser")}),
3636
)
37-
formfield_overrides = {
37+
formfield_overrides = { # noqa: RUF012
3838
"username": (WidgetType.SlugInput, {"required": True}),
3939
"password": (WidgetType.PasswordInput, {"passwordModalForm": True}),
4040
}

fastadmin/api/frameworks/fastapi/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ async def list_objs(
117117
request: Request,
118118
model: str,
119119
search: str | None = None,
120-
sort_by: str = None,
120+
sort_by: str | None = None,
121121
offset: int | None = 0,
122122
limit: int | None = 10,
123123
):
@@ -238,7 +238,7 @@ async def export(
238238
model: str,
239239
payload: ExportInputSchema,
240240
search: str | None = None,
241-
sort_by: str = None,
241+
sort_by: str | None = None,
242242
):
243243
"""This method is used to export a list of objects.
244244

fastadmin/api/frameworks/flask/api.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ async def sign_in() -> Response:
3737
except AdminApiException as e:
3838
http_exception = HTTPException(e.detail)
3939
http_exception.code = e.status_code
40-
raise http_exception
40+
raise http_exception from e
4141

4242

4343
@api_router.route("/sign-out", methods=["POST"])
@@ -57,7 +57,7 @@ async def sign_out() -> Response:
5757
except AdminApiException as e:
5858
http_exception = HTTPException(e.detail)
5959
http_exception.code = e.status_code
60-
raise http_exception
60+
raise http_exception from e
6161

6262

6363
@api_router.route("/me", methods=["GET"])
@@ -79,7 +79,7 @@ async def me() -> dict:
7979
except AdminApiException as e:
8080
http_exception = HTTPException(e.detail)
8181
http_exception.code = e.status_code
82-
raise http_exception
82+
raise http_exception from e
8383

8484

8585
@api_router.route("/dashboard-widget/<string:model>", methods=["GET"])
@@ -109,7 +109,7 @@ async def dashboard_widget(model: str) -> dict:
109109
except AdminApiException as e:
110110
http_exception = HTTPException(e.detail)
111111
http_exception.code = e.status_code
112-
raise http_exception
112+
raise http_exception from e
113113

114114

115115
@api_router.route("/list/<string:model>", methods=["GET"])
@@ -143,14 +143,14 @@ async def list_objs(model: str) -> dict:
143143
"total": total,
144144
"results": objs,
145145
}
146-
except ValueError:
146+
except ValueError as e:
147147
http_exception = HTTPException("Invalid format of get parameters")
148148
http_exception.code = 422
149-
raise http_exception
149+
raise http_exception from e
150150
except AdminApiException as e:
151151
http_exception = HTTPException(e.detail)
152152
http_exception.code = e.status_code
153-
raise http_exception
153+
raise http_exception from e
154154

155155

156156
@api_router.route("/retrieve/<string:model>/<string:id>", methods=["GET"])
@@ -174,7 +174,7 @@ async def get(model: str, id: UUID | int) -> dict:
174174
except AdminApiException as e:
175175
http_exception = HTTPException(e.detail)
176176
http_exception.code = e.status_code
177-
raise http_exception
177+
raise http_exception from e
178178

179179

180180
@api_router.route("/add/<string:model>", methods=["POST"])
@@ -195,7 +195,7 @@ async def add(model: str) -> dict:
195195
except AdminApiException as e:
196196
http_exception = HTTPException(e.detail)
197197
http_exception.code = e.status_code
198-
raise http_exception
198+
raise http_exception from e
199199

200200

201201
@api_router.route("/change-password/<string:id>", methods=["PATCH"]) # type: ignore [type-var]
@@ -221,7 +221,7 @@ async def change_password(id: UUID | int) -> UUID | int:
221221
except AdminApiException as e:
222222
http_exception = HTTPException(e.detail)
223223
http_exception.code = e.status_code
224-
raise http_exception
224+
raise http_exception from e
225225

226226

227227
@api_router.route("/change/<string:model>/<string:id>", methods=["PATCH"])
@@ -248,7 +248,7 @@ async def change(model: str, id: UUID | int) -> dict:
248248
except AdminApiException as e:
249249
http_exception = HTTPException(e.detail)
250250
http_exception.code = e.status_code
251-
raise http_exception
251+
raise http_exception from e
252252

253253

254254
@api_router.route("/export/<string:model>", methods=["POST"])
@@ -282,7 +282,7 @@ async def export(model: str) -> Response:
282282
except AdminApiException as e:
283283
http_exception = HTTPException(e.detail)
284284
http_exception.code = e.status_code
285-
raise http_exception
285+
raise http_exception from e
286286

287287

288288
@api_router.route("/delete/<string:model>/<string:id>", methods=["DELETE"]) # type: ignore [type-var]
@@ -309,7 +309,7 @@ async def delete(
309309
except AdminApiException as e:
310310
http_exception = HTTPException(e.detail)
311311
http_exception.code = e.status_code
312-
raise http_exception
312+
raise http_exception from e
313313

314314

315315
@api_router.route("/action/<string:model>/<string:action>", methods=["POST"])
@@ -337,7 +337,7 @@ async def action(
337337
except AdminApiException as e:
338338
http_exception = HTTPException(e.detail)
339339
http_exception.code = e.status_code
340-
raise http_exception
340+
raise http_exception from e
341341

342342

343343
@api_router.route("/configuration", methods=["GET"])

0 commit comments

Comments
 (0)