Skip to content

Commit 0fb5b22

Browse files
committed
Add toolbar actions to widget action results. Add table view to widget action results. Add JSON view to widget action results. Add str type for pk.
1 parent 9ed0d16 commit 0fb5b22

24 files changed

Lines changed: 1119 additions & 420 deletions

File tree

docs/build.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,16 @@ def read_cls_docstring(cls):
4444

4545
def get_versions():
4646
return [
47+
{
48+
"version": "0.4.8",
49+
"changes": [
50+
"Add toolbar actions to widget action results.",
51+
"Add table view to widget action results.",
52+
"Add JSON view to widget action results.",
53+
"Enhance a documentation for upload_file method.",
54+
"Add str type for pk.",
55+
],
56+
},
4757
{
4858
"version": "0.4.7",
4959
"changes": [

docs/index.html

Lines changed: 184 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ <h4 class="title">FastAdmin</h4>
192192

193193
<ul class="nav flex-column">
194194

195+
<li class="nav-item">
196+
<a class="nav-link" href="#v0_4_8">v0.4.8</a>
197+
</li>
198+
195199
<li class="nav-item">
196200
<a class="nav-link" href="#v0_4_7">v0.4.7</a>
197201
</li>
@@ -379,7 +383,7 @@ <h1>FastAdmin | Documentation</h1>
379383
<div class="row">
380384
<div class="col-sm-6 col-lg-4">
381385
<ul class="list-unstyled">
382-
<li><strong>Version:</strong> 0.4.7</li>
386+
<li><strong>Version:</strong> 0.4.8</li>
383387
<li>
384388
<strong>Author:</strong>
385389
<a href="mailto:vsdudakov@gmail.com" target="_blank">
@@ -396,7 +400,7 @@ <h1>FastAdmin | Documentation</h1>
396400
</li>
397401
<li>
398402
<strong>Updated:</strong>
399-
11 March 2026
403+
27 March 2026
400404
</li>
401405
</ul>
402406
</div>
@@ -952,9 +956,17 @@ <h3>Registering Models</h3>
952956
field_name: str,
953957
file_name: str,
954958
file_content: bytes,
955-
) -> None:
959+
) -> str:
960+
"""This method is used to upload files.
961+
962+
:params field_name: a name of field.
963+
:params file_name: a name of file.
964+
:params file_content: a content of file.
965+
:return: A file url.
966+
"""
956967
# save file to media directory or to s3/filestorage here
957-
return f"/media/{file_name}"
968+
# return a full url to the file
969+
return f"https://fastadmin.io/media/{file_name}"
958970

959971

960972
@register(User)
@@ -1589,14 +1601,22 @@ <h3>Registering Models</h3>
15891601
user.password = password
15901602
user.save()
15911603

1592-
def upload_file(
1604+
async def upload_file(
15931605
self,
15941606
field_name: str,
15951607
file_name: str,
15961608
file_content: bytes,
15971609
) -> str:
1610+
"""This method is used to upload files.
1611+
1612+
:params field_name: a name of field.
1613+
:params file_name: a name of file.
1614+
:params file_content: a content of file.
1615+
:return: A file url.
1616+
"""
15981617
# save file to media directory or to s3/filestorage here
1599-
return f"/media/{file_name}"
1618+
# return a full url to the file
1619+
return f"https://fastadmin.io/media/{file_name}"
16001620

16011621
async def pre_generate_models_schema(self) -> None:
16021622
def get_options() -> list:
@@ -2032,9 +2052,17 @@ <h3>Registering Models</h3>
20322052
field_name: str,
20332053
file_name: str,
20342054
file_content: bytes,
2035-
) -> None:
2055+
) -> str:
2056+
"""This method is used to upload files.
2057+
2058+
:params field_name: a name of field.
2059+
:params file_name: a name of file.
2060+
:params file_content: a content of file.
2061+
:return: A file url.
2062+
"""
20362063
# save file to media directory or to s3/filestorage here
2037-
return f"/media/{file_name}"
2064+
# return a full url to the file
2065+
return f"https://fastadmin.io/media/{file_name}"
20382066

20392067
async def pre_generate_models_schema(self) -> None:
20402068
sessionmaker = self.get_sessionmaker()
@@ -2511,14 +2539,22 @@ <h3>Registering Models</h3>
25112539
obj.password = password
25122540
commit()
25132541

2514-
def upload_file(
2542+
async def upload_file(
25152543
self,
25162544
field_name: str,
25172545
file_name: str,
25182546
file_content: bytes,
25192547
) -> str:
2548+
"""This method is used to upload files.
2549+
2550+
:params field_name: a name of field.
2551+
:params file_name: a name of file.
2552+
:params file_content: a content of file.
2553+
:return: A file url.
2554+
"""
25202555
# save file to media directory or to s3/filestorage here
2521-
return f"/media/{file_name}"
2556+
# return a full url to the file
2557+
return f"https://fastadmin.io/media/{file_name}"
25222558

25232559
async def pre_generate_models_schema(self) -> None:
25242560
def get_options() -> list:
@@ -3259,7 +3295,7 @@ <h3>Methods and Attributes</h3>
32593295
"""
32603296
raise NotImplementedError
32613297

3262-
async def orm_save_m2m_ids(self, obj: Any, field: str, ids: list[int | UUID]) -> None:
3298+
async def orm_save_m2m_ids(self, obj: Any, field: str, ids: list[int | str | UUID]) -> None:
32633299
"""This method is used to get m2m ids.
32643300

32653301
:params obj: an object.
@@ -4021,9 +4057,17 @@ <h3>Registering Inlines</h3>
40214057
field_name: str,
40224058
file_name: str,
40234059
file_content: bytes,
4024-
) -> None:
4060+
) -> str:
4061+
"""This method is used to upload files.
4062+
4063+
:params field_name: a name of field.
4064+
:params file_name: a name of file.
4065+
:params file_content: a content of file.
4066+
:return: A file url.
4067+
"""
40254068
# save file to media directory or to s3/filestorage here
4026-
return f"/media/{file_name}"
4069+
# return a full url to the file
4070+
return f"https://fastadmin.io/media/{file_name}"
40274071

40284072

40294073
@register(User)
@@ -4658,14 +4702,22 @@ <h3>Registering Inlines</h3>
46584702
user.password = password
46594703
user.save()
46604704

4661-
def upload_file(
4705+
async def upload_file(
46624706
self,
46634707
field_name: str,
46644708
file_name: str,
46654709
file_content: bytes,
46664710
) -> str:
4711+
"""This method is used to upload files.
4712+
4713+
:params field_name: a name of field.
4714+
:params file_name: a name of file.
4715+
:params file_content: a content of file.
4716+
:return: A file url.
4717+
"""
46674718
# save file to media directory or to s3/filestorage here
4668-
return f"/media/{file_name}"
4719+
# return a full url to the file
4720+
return f"https://fastadmin.io/media/{file_name}"
46694721

46704722
async def pre_generate_models_schema(self) -> None:
46714723
def get_options() -> list:
@@ -5101,9 +5153,17 @@ <h3>Registering Inlines</h3>
51015153
field_name: str,
51025154
file_name: str,
51035155
file_content: bytes,
5104-
) -> None:
5156+
) -> str:
5157+
"""This method is used to upload files.
5158+
5159+
:params field_name: a name of field.
5160+
:params file_name: a name of file.
5161+
:params file_content: a content of file.
5162+
:return: A file url.
5163+
"""
51055164
# save file to media directory or to s3/filestorage here
5106-
return f"/media/{file_name}"
5165+
# return a full url to the file
5166+
return f"https://fastadmin.io/media/{file_name}"
51075167

51085168
async def pre_generate_models_schema(self) -> None:
51095169
sessionmaker = self.get_sessionmaker()
@@ -5580,14 +5640,22 @@ <h3>Registering Inlines</h3>
55805640
obj.password = password
55815641
commit()
55825642

5583-
def upload_file(
5643+
async def upload_file(
55845644
self,
55855645
field_name: str,
55865646
file_name: str,
55875647
file_content: bytes,
55885648
) -> str:
5649+
"""This method is used to upload files.
5650+
5651+
:params field_name: a name of field.
5652+
:params file_name: a name of file.
5653+
:params file_content: a content of file.
5654+
:return: A file url.
5655+
"""
55895656
# save file to media directory or to s3/filestorage here
5590-
return f"/media/{file_name}"
5657+
# return a full url to the file
5658+
return f"https://fastadmin.io/media/{file_name}"
55915659

55925660
async def pre_generate_models_schema(self) -> None:
55935661
def get_options() -> list:
@@ -6529,6 +6597,103 @@ <h2>Changelog</h2>
65296597

65306598

65316599

6600+
<section id="v0_4_8">
6601+
<h3>v0.4.8</h3>
6602+
6603+
6604+
6605+
<p class="text-4">
6606+
Add toolbar actions to widget action results.
6607+
</p>
6608+
6609+
6610+
6611+
6612+
6613+
6614+
6615+
6616+
6617+
6618+
6619+
6620+
6621+
6622+
6623+
<p class="text-4">
6624+
Add table view to widget action results.
6625+
</p>
6626+
6627+
6628+
6629+
6630+
6631+
6632+
6633+
6634+
6635+
6636+
6637+
6638+
6639+
6640+
6641+
<p class="text-4">
6642+
Add JSON view to widget action results.
6643+
</p>
6644+
6645+
6646+
6647+
6648+
6649+
6650+
6651+
6652+
6653+
6654+
6655+
6656+
6657+
6658+
6659+
<p class="text-4">
6660+
Enhance a documentation for upload_file method.
6661+
</p>
6662+
6663+
6664+
6665+
6666+
6667+
6668+
6669+
6670+
6671+
6672+
6673+
6674+
6675+
6676+
6677+
<p class="text-4">
6678+
Add str type for pk.
6679+
</p>
6680+
6681+
6682+
6683+
6684+
6685+
6686+
6687+
6688+
6689+
6690+
6691+
6692+
6693+
6694+
</section>
6695+
6696+
65326697
<section id="v0_4_7">
65336698
<h3>v0.4.7</h3>
65346699

examples/django_djangoorm/orm/models.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,22 @@ def change_password(self, id: uuid.UUID | int, password: str) -> None:
133133
user.password = password
134134
user.save()
135135

136-
def upload_file(
136+
async def upload_file(
137137
self,
138138
field_name: str,
139139
file_name: str,
140140
file_content: bytes,
141141
) -> str:
142+
"""This method is used to upload files.
143+
144+
:params field_name: a name of field.
145+
:params file_name: a name of file.
146+
:params file_content: a content of file.
147+
:return: A file url.
148+
"""
142149
# save file to media directory or to s3/filestorage here
143-
return f"/media/{file_name}"
150+
# return a full url to the file
151+
return f"https://fastadmin.io/media/{file_name}"
144152

145153
async def pre_generate_models_schema(self) -> None:
146154
def get_options() -> list:

examples/fastapi_ponyorm/example.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,22 @@ def change_password(self, id: uuid.UUID | int, password: str) -> None:
8686
obj.password = password
8787
commit()
8888

89-
def upload_file(
89+
async def upload_file(
9090
self,
9191
field_name: str,
9292
file_name: str,
9393
file_content: bytes,
9494
) -> str:
95+
"""This method is used to upload files.
96+
97+
:params field_name: a name of field.
98+
:params file_name: a name of file.
99+
:params file_content: a content of file.
100+
:return: A file url.
101+
"""
95102
# save file to media directory or to s3/filestorage here
96-
return f"/media/{file_name}"
103+
# return a full url to the file
104+
return f"https://fastadmin.io/media/{file_name}"
97105

98106
async def pre_generate_models_schema(self) -> None:
99107
def get_options() -> list:

0 commit comments

Comments
 (0)