fastadmin 0.1.41__tar.gz → 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. {fastadmin-0.1.41 → fastadmin-0.2.1}/PKG-INFO +21 -22
  2. {fastadmin-0.1.41 → fastadmin-0.2.1}/README.md +18 -18
  3. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/api/frameworks/fastapi/api.py +2 -2
  4. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/api/frameworks/flask/api.py +14 -14
  5. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/api/helpers.py +13 -20
  6. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/api/service.py +5 -5
  7. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/models/base.py +2 -2
  8. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/models/decorators.py +1 -1
  9. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/models/orms/ponyorm.py +5 -5
  10. fastadmin-0.2.1/fastadmin/static/index.html +19 -0
  11. fastadmin-0.2.1/fastadmin/static/index.min.css +6 -0
  12. fastadmin-0.2.1/fastadmin/static/index.min.js +755 -0
  13. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/templates/index.html +2 -2
  14. {fastadmin-0.1.41 → fastadmin-0.2.1}/pyproject.toml +12 -12
  15. fastadmin-0.1.41/fastadmin/static/css/main.min.css +0 -7
  16. fastadmin-0.1.41/fastadmin/static/js/27.07bc2567.chunk.js +0 -1
  17. fastadmin-0.1.41/fastadmin/static/js/main.min.js +0 -2
  18. {fastadmin-0.1.41 → fastadmin-0.2.1}/LICENSE +0 -0
  19. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/__init__.py +0 -0
  20. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/api/__init__.py +0 -0
  21. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/api/exceptions.py +0 -0
  22. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/api/frameworks/__init__.py +0 -0
  23. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/api/frameworks/django/__init__.py +0 -0
  24. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/api/frameworks/django/app/__init__.py +0 -0
  25. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/api/frameworks/django/app/api.py +0 -0
  26. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/api/frameworks/django/app/urls.py +0 -0
  27. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/api/frameworks/django/app/views.py +0 -0
  28. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/api/frameworks/fastapi/__init__.py +0 -0
  29. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/api/frameworks/fastapi/app.py +0 -0
  30. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/api/frameworks/fastapi/views.py +0 -0
  31. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/api/frameworks/flask/__init__.py +0 -0
  32. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/api/frameworks/flask/app.py +0 -0
  33. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/api/frameworks/flask/views.py +0 -0
  34. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/api/schemas.py +0 -0
  35. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/models/__init__.py +0 -0
  36. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/models/helpers.py +0 -0
  37. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/models/orms/__init__.py +0 -0
  38. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/models/orms/django.py +0 -0
  39. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/models/orms/sqlalchemy.py +0 -0
  40. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/models/orms/tortoise.py +0 -0
  41. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/models/schemas.py +0 -0
  42. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/settings.py +0 -0
  43. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/static/images/favicon.png +0 -0
  44. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/static/images/header-logo.svg +0 -0
  45. {fastadmin-0.1.41 → fastadmin-0.2.1}/fastadmin/static/images/sign-in-logo.svg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastadmin
3
- Version: 0.1.41
3
+ Version: 0.2.1
4
4
  Summary:
5
5
  Home-page: https://github.com/vsdudakov/fastadmin
6
6
  License: MIT
@@ -17,6 +17,7 @@ Classifier: Operating System :: OS Independent
17
17
  Classifier: Programming Language :: Python :: 3
18
18
  Classifier: Programming Language :: Python :: 3.10
19
19
  Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
20
21
  Classifier: Topic :: Software Development :: Documentation
21
22
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
23
  Classifier: Topic :: Software Development :: Widget Sets
@@ -26,14 +27,13 @@ Provides-Extra: flask
26
27
  Provides-Extra: pony
27
28
  Provides-Extra: sqlalchemy
28
29
  Provides-Extra: tortoise-orm
29
- Requires-Dist: asgiref (>=3.6.0,<4.0.0)
30
+ Requires-Dist: asgiref (==3.6.0)
30
31
  Requires-Dist: django (==4.*) ; extra == "django"
31
32
  Requires-Dist: fastapi (==0.*) ; extra == "fastapi"
32
33
  Requires-Dist: flask (==2.*) ; extra == "flask"
33
- Requires-Dist: isort (>=5.12.0,<6.0.0)
34
+ Requires-Dist: greenlet (>=3.0.3,<4.0.0)
34
35
  Requires-Dist: jinja2 (>=3.1.2,<4.0.0)
35
36
  Requires-Dist: pony (==0.*) ; extra == "pony"
36
- Requires-Dist: pydantic (>=1.10.7,<2.0.0)
37
37
  Requires-Dist: pyjwt (>=2.6.0,<3.0.0)
38
38
  Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
39
39
  Requires-Dist: sqlalchemy (==2.*) ; extra == "sqlalchemy"
@@ -65,7 +65,7 @@ Description-Content-Type: text/markdown
65
65
 
66
66
  ## Introduction
67
67
 
68
-
68
+
69
69
  <a href='https://github.com/vsdudakov/fastadmin' target='_blank'>FastAdmin</a> is an easy-to-use Admin Dashboard App for FastAPI/Django/Flask inspired by Django Admin.
70
70
 
71
71
 
@@ -81,7 +81,7 @@ Description-Content-Type: text/markdown
81
81
 
82
82
 
83
83
 
84
-
84
+
85
85
  FastAdmin was built with relations in mind and admiration for the excellent and popular Django Admin. It's engraved in its design that you may configure your admin dashboard for FastAPI/Django/Flask easiest way.
86
86
 
87
87
 
@@ -97,7 +97,7 @@ FastAdmin was built with relations in mind and admiration for the excellent and
97
97
 
98
98
 
99
99
 
100
-
100
+
101
101
  FastAdmin is designed to be minimalistic, functional and yet familiar.
102
102
 
103
103
 
@@ -119,7 +119,7 @@ FastAdmin is designed to be minimalistic, functional and yet familiar.
119
119
 
120
120
  ## Getting Started
121
121
 
122
-
122
+
123
123
 
124
124
 
125
125
 
@@ -139,7 +139,7 @@ If you have any questions that are beyond the scope of the documentation, Please
139
139
 
140
140
  ### Installation
141
141
 
142
-
142
+
143
143
 
144
144
 
145
145
  Follow the steps below to setup FastAdmin:
@@ -155,7 +155,7 @@ Follow the steps below to setup FastAdmin:
155
155
 
156
156
 
157
157
 
158
-
158
+
159
159
  Install the package using pip:
160
160
 
161
161
 
@@ -171,7 +171,7 @@ Install the package using pip:
171
171
 
172
172
 
173
173
 
174
-
174
+
175
175
 
176
176
 
177
177
 
@@ -187,7 +187,7 @@ Note: For zsh and macos use: <code>pip install fastadmin[fastapi,django]</code>
187
187
 
188
188
 
189
189
 
190
-
190
+
191
191
 
192
192
 
193
193
 
@@ -213,7 +213,7 @@ pip install fastadmin[flask,sqlalchemy] # for flask with sqlalchemy
213
213
 
214
214
 
215
215
 
216
-
216
+
217
217
  Install the package using poetry:
218
218
 
219
219
 
@@ -229,7 +229,7 @@ Install the package using poetry:
229
229
 
230
230
 
231
231
 
232
-
232
+
233
233
 
234
234
 
235
235
 
@@ -255,7 +255,7 @@ poetry add 'fastadmin[flask,sqlalchemy]' # for flask with sqlalchemy
255
255
 
256
256
 
257
257
 
258
-
258
+
259
259
  Configure required settings using virtual environment variables:
260
260
 
261
261
 
@@ -271,7 +271,7 @@ Configure required settings using virtual environment variables:
271
271
 
272
272
 
273
273
 
274
-
274
+
275
275
 
276
276
 
277
277
 
@@ -287,7 +287,7 @@ Note: You can add these variables to .env and use python-dotenv to load them. Se
287
287
 
288
288
 
289
289
 
290
-
290
+
291
291
 
292
292
 
293
293
 
@@ -312,7 +312,7 @@ export ADMIN_SECRET_KEY=secret_key
312
312
 
313
313
  ### Quick Tutorial
314
314
 
315
-
315
+
316
316
 
317
317
 
318
318
  Setup FastAdmin for a framework
@@ -328,7 +328,7 @@ Setup FastAdmin for a framework
328
328
 
329
329
 
330
330
 
331
-
331
+
332
332
 
333
333
 
334
334
 
@@ -432,7 +432,7 @@ app.register_blueprint(admin_app, url_prefix="/admin")
432
432
 
433
433
 
434
434
 
435
-
435
+
436
436
 
437
437
 
438
438
  Register ORM models
@@ -448,7 +448,7 @@ Register ORM models
448
448
 
449
449
 
450
450
 
451
-
451
+
452
452
 
453
453
 
454
454
 
@@ -722,4 +722,3 @@ See full documentation [here](https://vsdudakov.github.io/fastadmin).
722
722
 
723
723
  ## License
724
724
  This project is licensed under the MIT License - see the [LICENSE](https://github.com/vsdudakov/fastadmin/blob/main/LICENSE) file for details.
725
-
@@ -22,7 +22,7 @@
22
22
 
23
23
  ## Introduction
24
24
 
25
-
25
+
26
26
  <a href='https://github.com/vsdudakov/fastadmin' target='_blank'>FastAdmin</a> is an easy-to-use Admin Dashboard App for FastAPI/Django/Flask inspired by Django Admin.
27
27
 
28
28
 
@@ -38,7 +38,7 @@
38
38
 
39
39
 
40
40
 
41
-
41
+
42
42
  FastAdmin was built with relations in mind and admiration for the excellent and popular Django Admin. It's engraved in its design that you may configure your admin dashboard for FastAPI/Django/Flask easiest way.
43
43
 
44
44
 
@@ -54,7 +54,7 @@ FastAdmin was built with relations in mind and admiration for the excellent and
54
54
 
55
55
 
56
56
 
57
-
57
+
58
58
  FastAdmin is designed to be minimalistic, functional and yet familiar.
59
59
 
60
60
 
@@ -76,7 +76,7 @@ FastAdmin is designed to be minimalistic, functional and yet familiar.
76
76
 
77
77
  ## Getting Started
78
78
 
79
-
79
+
80
80
 
81
81
 
82
82
 
@@ -96,7 +96,7 @@ If you have any questions that are beyond the scope of the documentation, Please
96
96
 
97
97
  ### Installation
98
98
 
99
-
99
+
100
100
 
101
101
 
102
102
  Follow the steps below to setup FastAdmin:
@@ -112,7 +112,7 @@ Follow the steps below to setup FastAdmin:
112
112
 
113
113
 
114
114
 
115
-
115
+
116
116
  Install the package using pip:
117
117
 
118
118
 
@@ -128,7 +128,7 @@ Install the package using pip:
128
128
 
129
129
 
130
130
 
131
-
131
+
132
132
 
133
133
 
134
134
 
@@ -144,7 +144,7 @@ Note: For zsh and macos use: <code>pip install fastadmin[fastapi,django]</code>
144
144
 
145
145
 
146
146
 
147
-
147
+
148
148
 
149
149
 
150
150
 
@@ -170,7 +170,7 @@ pip install fastadmin[flask,sqlalchemy] # for flask with sqlalchemy
170
170
 
171
171
 
172
172
 
173
-
173
+
174
174
  Install the package using poetry:
175
175
 
176
176
 
@@ -186,7 +186,7 @@ Install the package using poetry:
186
186
 
187
187
 
188
188
 
189
-
189
+
190
190
 
191
191
 
192
192
 
@@ -212,7 +212,7 @@ poetry add 'fastadmin[flask,sqlalchemy]' # for flask with sqlalchemy
212
212
 
213
213
 
214
214
 
215
-
215
+
216
216
  Configure required settings using virtual environment variables:
217
217
 
218
218
 
@@ -228,7 +228,7 @@ Configure required settings using virtual environment variables:
228
228
 
229
229
 
230
230
 
231
-
231
+
232
232
 
233
233
 
234
234
 
@@ -244,7 +244,7 @@ Note: You can add these variables to .env and use python-dotenv to load them. Se
244
244
 
245
245
 
246
246
 
247
-
247
+
248
248
 
249
249
 
250
250
 
@@ -269,7 +269,7 @@ export ADMIN_SECRET_KEY=secret_key
269
269
 
270
270
  ### Quick Tutorial
271
271
 
272
-
272
+
273
273
 
274
274
 
275
275
  Setup FastAdmin for a framework
@@ -285,7 +285,7 @@ Setup FastAdmin for a framework
285
285
 
286
286
 
287
287
 
288
-
288
+
289
289
 
290
290
 
291
291
 
@@ -389,7 +389,7 @@ app.register_blueprint(admin_app, url_prefix="/admin")
389
389
 
390
390
 
391
391
 
392
-
392
+
393
393
 
394
394
 
395
395
  Register ORM models
@@ -405,7 +405,7 @@ Register ORM models
405
405
 
406
406
 
407
407
 
408
-
408
+
409
409
 
410
410
 
411
411
 
@@ -678,4 +678,4 @@ class UserAdmin(PonyORMModelAdmin):
678
678
  See full documentation [here](https://vsdudakov.github.io/fastadmin).
679
679
 
680
680
  ## License
681
- This project is licensed under the MIT License - see the [LICENSE](https://github.com/vsdudakov/fastadmin/blob/main/LICENSE) file for details.
681
+ This project is licensed under the MIT License - see the [LICENSE](https://github.com/vsdudakov/fastadmin/blob/main/LICENSE) file for details.
@@ -117,7 +117,7 @@ async def list_objs(
117
117
  request: Request,
118
118
  model: str,
119
119
  search: str | None = None,
120
- sort_by: str = None,
120
+ sort_by: str | None = None,
121
121
  offset: int | None = 0,
122
122
  limit: int | None = 10,
123
123
  ):
@@ -238,7 +238,7 @@ async def export(
238
238
  model: str,
239
239
  payload: ExportInputSchema,
240
240
  search: str | None = None,
241
- sort_by: str = None,
241
+ sort_by: str | None = None,
242
242
  ):
243
243
  """This method is used to export a list of objects.
244
244
 
@@ -37,7 +37,7 @@ async def sign_in() -> Response:
37
37
  except AdminApiException as e:
38
38
  http_exception = HTTPException(e.detail)
39
39
  http_exception.code = e.status_code
40
- raise http_exception
40
+ raise http_exception from e
41
41
 
42
42
 
43
43
  @api_router.route("/sign-out", methods=["POST"])
@@ -57,7 +57,7 @@ async def sign_out() -> Response:
57
57
  except AdminApiException as e:
58
58
  http_exception = HTTPException(e.detail)
59
59
  http_exception.code = e.status_code
60
- raise http_exception
60
+ raise http_exception from e
61
61
 
62
62
 
63
63
  @api_router.route("/me", methods=["GET"])
@@ -79,7 +79,7 @@ async def me() -> dict:
79
79
  except AdminApiException as e:
80
80
  http_exception = HTTPException(e.detail)
81
81
  http_exception.code = e.status_code
82
- raise http_exception
82
+ raise http_exception from e
83
83
 
84
84
 
85
85
  @api_router.route("/dashboard-widget/<string:model>", methods=["GET"])
@@ -109,7 +109,7 @@ async def dashboard_widget(model: str) -> dict:
109
109
  except AdminApiException as e:
110
110
  http_exception = HTTPException(e.detail)
111
111
  http_exception.code = e.status_code
112
- raise http_exception
112
+ raise http_exception from e
113
113
 
114
114
 
115
115
  @api_router.route("/list/<string:model>", methods=["GET"])
@@ -143,14 +143,14 @@ async def list_objs(model: str) -> dict:
143
143
  "total": total,
144
144
  "results": objs,
145
145
  }
146
- except ValueError:
146
+ except ValueError as e:
147
147
  http_exception = HTTPException("Invalid format of get parameters")
148
148
  http_exception.code = 422
149
- raise http_exception
149
+ raise http_exception from e
150
150
  except AdminApiException as e:
151
151
  http_exception = HTTPException(e.detail)
152
152
  http_exception.code = e.status_code
153
- raise http_exception
153
+ raise http_exception from e
154
154
 
155
155
 
156
156
  @api_router.route("/retrieve/<string:model>/<string:id>", methods=["GET"])
@@ -174,7 +174,7 @@ async def get(model: str, id: UUID | int) -> dict:
174
174
  except AdminApiException as e:
175
175
  http_exception = HTTPException(e.detail)
176
176
  http_exception.code = e.status_code
177
- raise http_exception
177
+ raise http_exception from e
178
178
 
179
179
 
180
180
  @api_router.route("/add/<string:model>", methods=["POST"])
@@ -195,7 +195,7 @@ async def add(model: str) -> dict:
195
195
  except AdminApiException as e:
196
196
  http_exception = HTTPException(e.detail)
197
197
  http_exception.code = e.status_code
198
- raise http_exception
198
+ raise http_exception from e
199
199
 
200
200
 
201
201
  @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:
221
221
  except AdminApiException as e:
222
222
  http_exception = HTTPException(e.detail)
223
223
  http_exception.code = e.status_code
224
- raise http_exception
224
+ raise http_exception from e
225
225
 
226
226
 
227
227
  @api_router.route("/change/<string:model>/<string:id>", methods=["PATCH"])
@@ -248,7 +248,7 @@ async def change(model: str, id: UUID | int) -> dict:
248
248
  except AdminApiException as e:
249
249
  http_exception = HTTPException(e.detail)
250
250
  http_exception.code = e.status_code
251
- raise http_exception
251
+ raise http_exception from e
252
252
 
253
253
 
254
254
  @api_router.route("/export/<string:model>", methods=["POST"])
@@ -282,7 +282,7 @@ async def export(model: str) -> Response:
282
282
  except AdminApiException as e:
283
283
  http_exception = HTTPException(e.detail)
284
284
  http_exception.code = e.status_code
285
- raise http_exception
285
+ raise http_exception from e
286
286
 
287
287
 
288
288
  @api_router.route("/delete/<string:model>/<string:id>", methods=["DELETE"]) # type: ignore [type-var]
@@ -309,7 +309,7 @@ async def delete(
309
309
  except AdminApiException as e:
310
310
  http_exception = HTTPException(e.detail)
311
311
  http_exception.code = e.status_code
312
- raise http_exception
312
+ raise http_exception from e
313
313
 
314
314
 
315
315
  @api_router.route("/action/<string:model>/<string:action>", methods=["POST"])
@@ -337,7 +337,7 @@ async def action(
337
337
  except AdminApiException as e:
338
338
  http_exception = HTTPException(e.detail)
339
339
  http_exception.code = e.status_code
340
- raise http_exception
340
+ raise http_exception from e
341
341
 
342
342
 
343
343
  @api_router.route("/configuration", methods=["GET"])
@@ -30,12 +30,11 @@ def sanitize_filter_key(key: str, fields: list[ModelFieldWidgetSchema]) -> tuple
30
30
  :return: A tuple of sanitized key and condition.
31
31
  """
32
32
  if "__" not in key:
33
- key = f"{key}__exact"
34
- field_name = key.split("__", 1)[0]
35
- condition = key.split("__", 1)[1]
33
+ key += "__exact"
34
+ field_name, _, condition = key.partition("__")
36
35
  field: ModelFieldWidgetSchema | None = next((field for field in fields if field.name == field_name), None)
37
36
  if field and field.filter_widget_props.get("parentModel") and not field.is_m2m:
38
- field_name = f"{field_name}_id"
37
+ field_name += "_id"
39
38
  return field_name, condition
40
39
 
41
40
 
@@ -52,32 +51,26 @@ def is_valid_uuid(uuid_to_test: str) -> bool:
52
51
  return str(uuid_obj) == uuid_to_test
53
52
 
54
53
 
55
- def is_digit(digit_to_test: str) -> bool:
56
- """Check if digit_to_test is a digit.
57
-
58
- :param digit_to_test: A digit to test.
59
- :return: True if digit_to_test is a digit, False otherwise.
60
- """
61
- try:
62
- int(digit_to_test)
63
- except ValueError:
64
- return False
65
- return True
66
-
67
-
68
54
  def is_valid_id(id: UUID | int) -> bool:
69
55
  """Check if id is a valid id.
70
56
 
71
57
  :param id: An id to test.
72
58
  :return: True if id is a valid id, False otherwise.
73
59
  """
74
- return is_digit(str(id)) or is_valid_uuid(str(id))
60
+ if is_valid_uuid(str(id)):
61
+ return True
62
+ try:
63
+ int(id)
64
+ return True
65
+ except ValueError:
66
+ pass
67
+ return False
75
68
 
76
69
 
77
70
  def is_valid_base64(value: str) -> bool:
78
- """Check if s is a valid base64.
71
+ """Check if a string is a valid base64.
79
72
 
80
- :param s: A string to test.
73
+ :param value: A string to test.
81
74
  :return: True if s is a valid base64, False otherwise.
82
75
  """
83
76
  try:
@@ -107,7 +107,7 @@ class ApiService:
107
107
  if inspect.iscoroutinefunction(admin_model.authenticate):
108
108
  authenticate_fn = admin_model.authenticate
109
109
  else:
110
- authenticate_fn = sync_to_async(admin_model.authenticate)
110
+ authenticate_fn = sync_to_async(admin_model.authenticate) # type: ignore [arg-type]
111
111
 
112
112
  user_id = await authenticate_fn(payload.username, payload.password)
113
113
 
@@ -162,7 +162,7 @@ class ApiService:
162
162
  if inspect.iscoroutinefunction(dashboard_widget_model.get_data):
163
163
  get_data = dashboard_widget_model.get_data
164
164
  else:
165
- get_data = sync_to_async(dashboard_widget_model.get_data)
165
+ get_data = sync_to_async(dashboard_widget_model.get_data) # type: ignore [arg-type]
166
166
  data = await get_data(
167
167
  min_x_field=query_params.min_x_field,
168
168
  max_x_field=query_params.max_x_field,
@@ -178,7 +178,7 @@ class ApiService:
178
178
  model: str,
179
179
  search: str | None = None,
180
180
  sort_by: str | None = None,
181
- filters: dict = None,
181
+ filters: dict | None = None,
182
182
  offset: int | None = 0,
183
183
  limit: int | None = 10,
184
184
  ) -> tuple[list[dict], int]:
@@ -302,7 +302,7 @@ class ApiService:
302
302
  if inspect.iscoroutinefunction(admin_model.change_password):
303
303
  change_password_fn = admin_model.change_password
304
304
  else:
305
- change_password_fn = sync_to_async(admin_model.change_password)
305
+ change_password_fn = sync_to_async(admin_model.change_password) # type: ignore [arg-type]
306
306
  await change_password_fn(id, payload.password)
307
307
 
308
308
  async def change(
@@ -332,7 +332,7 @@ class ApiService:
332
332
  payload: ExportInputSchema,
333
333
  search: str | None = None,
334
334
  sort_by: str | None = None,
335
- filters: dict = None,
335
+ filters: dict | None = None,
336
336
  ) -> tuple[str, str, StringIO | BytesIO | None]:
337
337
  current_user_id = await get_user_id_from_session_id(session_id)
338
338
  if not current_user_id:
@@ -87,7 +87,7 @@ class BaseModelAdmin:
87
87
  # formfield_overrides = {
88
88
  # "description": (WidgetType.RichTextArea, {})
89
89
  # }
90
- formfield_overrides: dict[str, tuple[WidgetType, dict]] = {}
90
+ formfield_overrides: dict[str, tuple[WidgetType, dict]] = {} # noqa: RUF012
91
91
 
92
92
  # Set list_display to control which fields are displayed on the list page of the admin.
93
93
  # If you don't set list_display, the admin site will display a single column that displays the __str__() representation of each object
@@ -104,7 +104,7 @@ class BaseModelAdmin:
104
104
  # list_display_widths = {
105
105
  # "id": "100px",
106
106
  # }
107
- list_display_widths: dict[str, str] = {}
107
+ list_display_widths: dict[str, str] = {} # noqa: RUF012
108
108
 
109
109
  # Set list_filter to activate filters in the tabel columns of the list page of the admin.
110
110
  # Example of usage: list_filter = ("is_superuser", "is_active", "created_at")
@@ -1,4 +1,4 @@
1
- def action(function=None, *, description: str = None):
1
+ def action(function=None, *, description: str | None = None):
2
2
  """Conveniently add attributes to an action function:
3
3
 
4
4
  Example of usage:
@@ -3,7 +3,7 @@ from typing import Any
3
3
  from uuid import UUID
4
4
 
5
5
  from asgiref.sync import sync_to_async
6
- from pony.orm import commit, db_session, delete, desc, flush, select
6
+ from pony.orm import commit, db_session, desc, flush, select
7
7
 
8
8
  from fastadmin.models.base import InlineModelAdmin, ModelAdmin
9
9
  from fastadmin.models.schemas import ModelFieldWidgetSchema, WidgetType
@@ -233,8 +233,8 @@ class PonyORMMixin:
233
233
  :return: A tuple of list of objects and total count.
234
234
  """
235
235
 
236
+ # import pdb; pdb.set_trace()
236
237
  qs = select(m for m in self.model_cls)
237
-
238
238
  if filters:
239
239
  for field_with_condition, value in filters.items():
240
240
  field = field_with_condition[0]
@@ -326,9 +326,9 @@ class PonyORMMixin:
326
326
  :params id: an id of object.
327
327
  :return: None.
328
328
  """
329
- delete(o for o in self.model_cls if getattr(o, self.get_model_pk_name(self.model_cls)) == id)
330
- flush()
331
- commit()
329
+ # delete(o for o in self.model_cls if getattr(o, self.get_model_pk_name(self.model_cls)) == id)
330
+ # flush()
331
+ # commit()
332
332
 
333
333
  @sync_to_async
334
334
  @db_session
@@ -0,0 +1,19 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <meta name="theme-color" content="#000000" />
7
+ <meta name="description" content="Fast Admin"/>
8
+ <title>Fast Admin</title>
9
+ <script>
10
+ window.SERVER_DOMAIN = 'http://localhost:8080';
11
+ window.SERVER_URL = 'http://localhost:8080/admin/api';
12
+ </script>
13
+ <script type="module" crossorigin src="/index.min.js"></script>
14
+ <link rel="stylesheet" crossorigin href="/index.min.css">
15
+ </head>
16
+ <body>
17
+ <div id="root"></div>
18
+ </body>
19
+ </html>