fastadmin 0.1.15__py3-none-any.whl → 0.1.17__py3-none-any.whl
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.
- fastadmin/api/api.py +3 -5
- fastadmin/models/base.py +13 -10
- fastadmin/models/orm/tortoise.py +1 -1
- fastadmin/schemas/configuration.py +1 -0
- fastadmin/static/js/main.min.js +3 -3
- fastadmin/static/js/main.min.js.map +1 -1
- {fastadmin-0.1.15.dist-info → fastadmin-0.1.17.dist-info}/METADATA +11 -110
- {fastadmin-0.1.15.dist-info → fastadmin-0.1.17.dist-info}/RECORD +10 -10
- {fastadmin-0.1.15.dist-info → fastadmin-0.1.17.dist-info}/LICENSE +0 -0
- {fastadmin-0.1.15.dist-info → fastadmin-0.1.17.dist-info}/WHEEL +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: fastadmin
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.17
|
4
4
|
Summary:
|
5
5
|
Home-page: https://github.com/vsdudakov/fastadmin
|
6
6
|
License: MIT
|
@@ -39,6 +39,12 @@ Description-Content-Type: text/markdown
|
|
39
39
|

|
40
40
|

|
41
41
|
|
42
|
+
<p align="center">
|
43
|
+
<a href="https://twitter.com/intent/tweet?text=Admin%20Dashboard%20For%20FastAPI&url=https://github.com/vsdudakov/fastadmin&hashtags=FastAPI,AdminDashboard">
|
44
|
+
<img alt="tweet" src="https://img.shields.io/twitter/url/https/twitter?label=Share%20on%20twitter&style=social" target="_blank" />
|
45
|
+
</a>
|
46
|
+
</p>
|
47
|
+
|
42
48
|
## Introduction
|
43
49
|
|
44
50
|
FastAdmin is an easy-to-use Admin App for FastAPI inspired by Django Admin.
|
@@ -158,122 +164,17 @@ class GroupAdmin(TortoiseModelAdmin):
|
|
158
164
|
|
159
165
|
#### Run your project
|
160
166
|
|
161
|
-
Run your project (see https://fastapi.tiangolo.com/tutorial/first-steps/):
|
167
|
+
Run your project (see [https://fastapi.tiangolo.com/tutorial/first-steps/](https://fastapi.tiangolo.com/tutorial/first-steps/)):
|
162
168
|
|
163
169
|
```bash
|
164
170
|
uvicorn ...
|
165
171
|
```
|
166
172
|
|
167
|
-
Go to http://localhost:8000/admin
|
168
|
-
|
169
|
-
## Configuration
|
170
|
-
|
171
|
-
You can find all env variables to configure FastAdmin [here](https://github.com/vsdudakov/fastadmin/blob/main/fastadmin/settings.py)
|
172
|
-
|
173
|
-
You can find all parameters and methods to configure your ModelAdmin classes [here](https://github.com/vsdudakov/fastadmin/blob/main/fastadmin/models/base.py)
|
174
|
-
|
175
|
-
Example:
|
176
|
-
|
177
|
-
```python
|
178
|
-
from fastadmin import TortoiseModelAdmin, register, action, display
|
179
|
-
|
180
|
-
@register(User)
|
181
|
-
class UserAdmin(TortoiseModelAdmin):
|
182
|
-
label_fields = ("email", "id")
|
183
|
-
exclude = ("hash_password",)
|
184
|
-
list_display = ("id", "email", "has_hash_password", "is_superuser", "is_active")
|
185
|
-
list_display_links = ("id",)
|
186
|
-
list_filter = ("id", "email", "is_superuser")
|
187
|
-
search_fields = ("email",)
|
188
|
-
actions = ("set_as_active",)
|
173
|
+
Go to [http://localhost:8000/admin](http://localhost:8000/admin).
|
189
174
|
|
190
|
-
|
191
|
-
return False
|
175
|
+
## Documentation
|
192
176
|
|
193
|
-
|
194
|
-
async def set_as_active(self, ids: list[int | UUID]) -> None:
|
195
|
-
await User.filter(id__in=ids).update(is_active=True)
|
196
|
-
|
197
|
-
@display
|
198
|
-
async def has_hash_password(self, obj: Any) -> Any:
|
199
|
-
return obj.hash_password is not None
|
200
|
-
|
201
|
-
...
|
202
|
-
```
|
203
|
-
|
204
|
-
## Other ORMs or own implementation
|
205
|
-
|
206
|
-
We are going to support SQLAlchemy and Pony ORM soon...
|
207
|
-
|
208
|
-
If you have smth else (your own implementation of ORM and so on) you will may overload ModelAdmin class and implement the following interfaces
|
209
|
-
|
210
|
-
```python
|
211
|
-
from typing import Any
|
212
|
-
from collections import OrderedDict
|
213
|
-
from fastadmin import ModelAdmin, WidgetType
|
214
|
-
|
215
|
-
class MyModelAdmin(ModelAdmin):
|
216
|
-
async def save_model(self, id: UUID | int | None, payload: dict) -> dict | None:
|
217
|
-
"""This method is used to save orm/db model object.
|
218
|
-
|
219
|
-
:params id: an id of object.
|
220
|
-
:params payload: a payload from request.
|
221
|
-
:return: A saved object or None.
|
222
|
-
"""
|
223
|
-
raise NotImplementedError
|
224
|
-
|
225
|
-
async def delete_model(self, id: UUID | int) -> None:
|
226
|
-
"""This method is used to delete orm/db model object.
|
227
|
-
|
228
|
-
:params id: an id of object.
|
229
|
-
:return: None.
|
230
|
-
"""
|
231
|
-
raise NotImplementedError
|
232
|
-
|
233
|
-
async def get_obj(self, id: UUID | int) -> dict | None:
|
234
|
-
"""This method is used to get orm/db model object by id.
|
235
|
-
|
236
|
-
:params id: an id of object.
|
237
|
-
:return: An object or None.
|
238
|
-
"""
|
239
|
-
raise NotImplementedError
|
240
|
-
|
241
|
-
async def get_list(
|
242
|
-
self,
|
243
|
-
offset: int | None = None,
|
244
|
-
limit: int | None = None,
|
245
|
-
search: str | None = None,
|
246
|
-
sort_by: str | None = None,
|
247
|
-
filters: dict | None = None,
|
248
|
-
) -> tuple[list[dict], int]:
|
249
|
-
"""This method is used to get list of orm/db model objects.
|
250
|
-
|
251
|
-
:params offset: an offset for pagination.
|
252
|
-
:params limit: a limit for pagination.
|
253
|
-
:params search: a search query.
|
254
|
-
:params sort_by: a sort by field name.
|
255
|
-
:params filters: a dict of filters.
|
256
|
-
:return: A tuple of list of objects and total count.
|
257
|
-
"""
|
258
|
-
raise NotImplementedError
|
259
|
-
|
260
|
-
def get_model_fields(self) -> OrderedDict[str, dict]:
|
261
|
-
"""This method is used to get all orm/db model fields
|
262
|
-
with saving ordering (non relations, fk, o2o, m2m).
|
263
|
-
|
264
|
-
:return: An OrderedDict of model fields.
|
265
|
-
"""
|
266
|
-
raise NotImplementedError
|
267
|
-
|
268
|
-
def get_form_widget(self, field_name: str) -> tuple[WidgetType, dict]:
|
269
|
-
"""This method is used to get form item widget
|
270
|
-
for field from orm/db model.
|
271
|
-
|
272
|
-
:params field_name: a model field name.
|
273
|
-
:return: A tuple of widget type and widget props.
|
274
|
-
"""
|
275
|
-
raise NotImplementedError
|
276
|
-
```
|
177
|
+
See full documentation [here](https://vsdudakov.github.io/fastadmin/).
|
277
178
|
|
278
179
|
## License
|
279
180
|
|
@@ -1,19 +1,19 @@
|
|
1
1
|
LICENSE,sha256=-5Cmq6xd5DlFq8rhBcqGMi8Mlh_h-YVjKOYjnYk5dyM,1063
|
2
2
|
fastadmin/__init__.py,sha256=sLDFNirUYkuv-VYh6fPFs8tQfU6puC8hN0Al0UcI8WM,310
|
3
3
|
fastadmin/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
-
fastadmin/api/api.py,sha256=
|
4
|
+
fastadmin/api/api.py,sha256=5Hp5I4BYje-Hb-Yx4SWKmYb3X3eq1B4dg7wlfo6gxsk,15955
|
5
5
|
fastadmin/api/depends.py,sha256=d73Ufqho51fXyzp9zNYOdOItNMU_Q8wifLTLR4FqSJ4,1518
|
6
6
|
fastadmin/api/helpers.py,sha256=SJ0peUtrKsmEzCu0Z0KHJAUeI7AJs5Fwloda29jz0sg,293
|
7
7
|
fastadmin/app.py,sha256=MsuLf6bCO82IpsHv10K-fdlZJ-UTLOuFq9-NuKHXdIw,659
|
8
8
|
fastadmin/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
|
-
fastadmin/models/base.py,sha256=
|
9
|
+
fastadmin/models/base.py,sha256=LeYldh_b9H52aVZSlj6UpTgyg_XKf9R9KXvdXYoaUa0,20954
|
10
10
|
fastadmin/models/decorators.py,sha256=X3WYb1DRk0OQBM4CHPQpcVmlioQpQkBOg7svPXijxpM,1952
|
11
11
|
fastadmin/models/helpers.py,sha256=ipqzOfJlI0CUH9iX1Gtdy2Kaes8Jihx7JY9S7X6J7hI,1558
|
12
12
|
fastadmin/models/orm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
|
-
fastadmin/models/orm/tortoise.py,sha256=
|
13
|
+
fastadmin/models/orm/tortoise.py,sha256=_VSUaEUt-I-m8D7H1kMlVLlLjXJkH-Sbpc_tvuyPQPQ,13920
|
14
14
|
fastadmin/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
15
15
|
fastadmin/schemas/api.py,sha256=mDHV0Hb4cBSEIVsCLcVoaCxbse3zfJrie57IrBmiZPw,475
|
16
|
-
fastadmin/schemas/configuration.py,sha256=
|
16
|
+
fastadmin/schemas/configuration.py,sha256=7N8pQ6vdN18fmM5gxJdvGkJBUwrfYw5u3d0LtpHxmEI,2788
|
17
17
|
fastadmin/settings.py,sha256=K8G9oXYD2sNs-VHIP7PQQNOqmD2hq-MWWD1M65hIDDA,863
|
18
18
|
fastadmin/static/css/main.min.css,sha256=ywdS7o8G1nCGvmQ6Pcf2oOW6UEclxgyWyrT7-VYetVw,338
|
19
19
|
fastadmin/static/css/main.min.css.map,sha256=N1fWreIFJPEjGjYLYrC7BH60GRQiIntkIFrEfThBMD4,577
|
@@ -22,11 +22,11 @@ fastadmin/static/images/header-logo.svg,sha256=FfFOShL7p4EvggDS106VDcMzI_Oe7zAG7
|
|
22
22
|
fastadmin/static/images/sign-in-logo.svg,sha256=sD6YXIwT0kOvZTCGxyoUMiIoszXV77OBxFLvlZOYEeE,1359
|
23
23
|
fastadmin/static/js/787.cda612ba.chunk.js,sha256=-RCoc7bpkR5Qc6h9hEIbw6X_JUO_cv37kwW5dVF5Puk,4598
|
24
24
|
fastadmin/static/js/787.cda612ba.chunk.js.map,sha256=q92gAWgbcGnaqv7QywNICs53249Z6Z9oybAwQCojZCk,10593
|
25
|
-
fastadmin/static/js/main.min.js,sha256=
|
26
|
-
fastadmin/static/js/main.min.js.map,sha256=
|
25
|
+
fastadmin/static/js/main.min.js,sha256=5hSo50uN-fea9OdhpcRJh7hFGgMk6d5DD4WroYeESd0,1375297
|
26
|
+
fastadmin/static/js/main.min.js.map,sha256=cX46ZH17nRnRj6U3lb9RPgh-ajQJ_K1c85T6_SOynf8,5601821
|
27
27
|
fastadmin/templates/index.html,sha256=QKlszqiykreOqpgJTlym78fzBClL3W9Q6v8QkLVBZgQ,749
|
28
28
|
fastadmin/views.py,sha256=jQvg4wwkEv4SJob5Z0duP-O7N0b3cpPEMDcKb3KG2MA,698
|
29
|
-
fastadmin-0.1.
|
30
|
-
fastadmin-0.1.
|
31
|
-
fastadmin-0.1.
|
32
|
-
fastadmin-0.1.
|
29
|
+
fastadmin-0.1.17.dist-info/LICENSE,sha256=-5Cmq6xd5DlFq8rhBcqGMi8Mlh_h-YVjKOYjnYk5dyM,1063
|
30
|
+
fastadmin-0.1.17.dist-info/METADATA,sha256=20luf3UFlvhTNEOrH3Z2dPbUZqoyGz0n_tYNyonjPVw,5670
|
31
|
+
fastadmin-0.1.17.dist-info/WHEEL,sha256=kLuE8m1WYU0Ig0_YEGrXyTtiJvKPpLpDEiChiNyei5Y,88
|
32
|
+
fastadmin-0.1.17.dist-info/RECORD,,
|
File without changes
|
File without changes
|