@@ -196,6 +196,10 @@ <h4 class="title">FastAdmin</h4>
196196
197197 < ul class ="nav flex-column ">
198198
199+ < li class ="nav-item ">
200+ < a class ="nav-link " href ="#v0_4_1 "> v0.4.1</ a >
201+ </ li >
202+
199203 < li class ="nav-item ">
200204 < a class ="nav-link " href ="#v0_4_0 "> v0.4.0</ a >
201205 </ li >
@@ -355,7 +359,7 @@ <h1>FastAdmin | Documentation</h1>
355359 < div class ="row ">
356360 < div class ="col-sm-6 col-lg-4 ">
357361 < ul class ="list-unstyled ">
358- < li > < strong > Version:</ strong > 0.4.0 </ li >
362+ < li > < strong > Version:</ strong > 0.4.1 </ li >
359363 < li >
360364 < strong > Author:</ strong >
361365 < a href ="mailto:vsdudakov@gmail.com " target ="_blank ">
@@ -953,7 +957,7 @@ <h3>Quick Tutorial</h3>
953957 user.hash_password = bcrypt.hashpw(password.encode(), bcrypt.gensalt()).decode()
954958 await user.save(update_fields=("hash_password",))
955959
956- async def upload_file(self, obj: tp.Any, field_name: str, file_name: str, file_content: bytes) -> str:
960+ async def upload_file(self, field_name: str, file_name: str, file_content: bytes) -> str:
957961 # save file to media directory or s3/filestorage, then return the file url
958962 return f"/media/{file_name}"
959963
@@ -980,8 +984,6 @@ <h3>Quick Tutorial</h3>
980984
981985< pre >
982986 < code class ="language-python ">
983- import typing as tp
984-
985987from django.db import models
986988
987989from fastadmin import DjangoModelAdmin, register
@@ -1014,7 +1016,7 @@ <h3>Quick Tutorial</h3>
10141016 return None
10151017 return obj.id
10161018
1017- def upload_file(self, obj: tp.Any, field_name: str, file_name: str, file_content: bytes) -> str: # type: ignore[override]
1019+ def upload_file(self, field_name: str, file_name: str, file_content: bytes) -> str: # type: ignore[override]
10181020 # save file to media directory or s3/filestorage, then return the file url
10191021 return f"/media/{file_name}"
10201022
@@ -1041,7 +1043,6 @@ <h3>Quick Tutorial</h3>
10411043
10421044< pre >
10431045 < code class ="language-python ">
1044- import typing as tp
10451046import uuid
10461047
10471048import bcrypt
@@ -1107,7 +1108,7 @@ <h3>Quick Tutorial</h3>
11071108 await session.execute(query)
11081109 await session.commit()
11091110
1110- async def upload_file(self, obj: tp.Any, field_name: str, file_name: str, file_content: bytes) -> str:
1111+ async def upload_file(self, field_name: str, file_name: str, file_content: bytes) -> str:
11111112 # save file to media directory or s3/filestorage, then return the file url
11121113 return f"/media/{file_name}"
11131114
@@ -1134,7 +1135,6 @@ <h3>Quick Tutorial</h3>
11341135
11351136< pre >
11361137 < code class ="language-python ">
1137- import typing as tp
11381138import uuid
11391139
11401140import bcrypt
@@ -1188,7 +1188,7 @@ <h3>Quick Tutorial</h3>
11881188 obj.hash_password = hash_password
11891189 commit()
11901190
1191- def upload_file(self, obj: tp.Any, field_name: str, file_name: str, file_content: bytes) -> str: # type: ignore[override]
1191+ def upload_file(self, field_name: str, file_name: str, file_content: bytes) -> str: # type: ignore[override]
11921192 # save file to media directory or s3/filestorage, then return the file url
11931193 return f"/media/{file_name}"
11941194
@@ -1883,7 +1883,6 @@ <h3>Registering Models</h3>
18831883
18841884< pre >
18851885 < code class ="language-python ">
1886- import typing as tp
18871886from uuid import UUID
18881887
18891888import bcrypt
@@ -1962,11 +1961,9 @@ <h3>Registering Models</h3>
19621961 async def deactivate(self, ids: list[int]) -> None:
19631962 await self.model_cls.filter(id__in=ids).update(is_active=False)
19641963
1965- async def upload_file(self, obj: tp.Any, field_name: str, file_name: str, file_content: bytes) -> str:
1964+ async def upload_file(self, field_name: str, file_name: str, file_content: bytes) -> str:
19661965 # save file to media directory or s3/filestorage, then return the file url
19671966 url = f"/media/{file_name}"
1968- setattr(obj, field_name, url)
1969- await obj.save(update_fields=(field_name,))
19701967 return url
19711968
19721969 </ code >
@@ -2628,14 +2625,12 @@ <h3>Methods and Attributes</h3>
26282625
26292626 async def upload_file(
26302627 self,
2631- obj: Any,
26322628 field_name: str,
26332629 file_name: str,
26342630 file_content: bytes,
26352631 ) -> str:
26362632 """This method is used to upload files.
26372633
2638- :params obj: an object.
26392634 :params field_name: a name of field.
26402635 :params file_name: a name of file.
26412636 :params file_content: a content of file.
@@ -3402,6 +3397,31 @@ <h2>Changelog</h2>
34023397
34033398
34043399
3400+ < section id ="v0_4_1 ">
3401+ < h3 > v0.4.1</ h3 >
3402+
3403+
3404+
3405+ < p class ="text-4 ">
3406+ Fix upload file functionality. Fix examples.
3407+ </ p >
3408+
3409+
3410+
3411+
3412+
3413+
3414+
3415+
3416+
3417+
3418+
3419+
3420+
3421+
3422+ </ section >
3423+
3424+
34053425 < section id ="v0_4_0 ">
34063426 < h3 > v0.4.0</ h3 >
34073427
0 commit comments