@@ -217,11 +217,11 @@ class RelationSelectApi:
217217 """
218218
219219 async def get_selects (
220- self ,
221- request : Request ,
222- pk : Optional [str ],
223- perPage : Optional [int ],
224- page : Optional [int ],
220+ self ,
221+ request : Request ,
222+ pk : Optional [str ],
223+ perPage : Optional [int ],
224+ page : Optional [int ],
225225 ) -> List [dict ]:
226226 pass
227227
@@ -235,11 +235,11 @@ class ForeignKeyPickerControl(BaseAdminControl, RelationSelectApi): # todo 支
235235 _field : fields .ForeignKeyRelation
236236
237237 async def get_selects (
238- self ,
239- request : Request ,
240- pk : Optional [str ],
241- perPage : Optional [int ],
242- page : Optional [int ],
238+ self ,
239+ request : Request ,
240+ pk : Optional [str ],
241+ perPage : Optional [int ],
242+ page : Optional [int ],
243243 ):
244244 field_model_all = self ._field .related_model .all () # type: ignore
245245 if perPage is not None and page is not None :
@@ -297,11 +297,11 @@ class ForeignKeyControl(BaseAdminControl, RelationSelectApi):
297297 _control_type = ControlEnum .select
298298
299299 async def get_selects (
300- self ,
301- request : Request ,
302- pk : Optional [str ],
303- perPage : Optional [int ],
304- page : Optional [int ],
300+ self ,
301+ request : Request ,
302+ pk : Optional [str ],
303+ perPage : Optional [int ],
304+ page : Optional [int ],
305305 ):
306306 field_model_all = self ._field .related_model .all () # type: ignore
307307 if perPage is not None and page is not None :
@@ -322,7 +322,7 @@ def prefetch(self) -> Optional[str]:
322322 def get_column (self , request : Request ) -> Column :
323323 if not self ._column :
324324 self ._column = Custom (
325- label = "作者" ,
325+ label = self . name ,
326326 name = self .name ,
327327 onMount = f"const text = document.createTextNode(value.label);dom.appendChild(text);${ self .name } =value.value;" ,
328328 onUpdate = f"const value=data.{ self .name } ;dom.current.firstChild.textContent=value.label;${ self .name } =value.value;" ,
@@ -374,8 +374,8 @@ def get_column(self, request: Request) -> Column:
374374 title = self .label ,
375375 body = CRUD (
376376 api = "get:"
377- + self ._field .model .__name__ # type: ignore
378- + f"/select/{ self .name } ?pk=$pk" ,
377+ + self ._field .model .__name__ # type: ignore
378+ + f"/select/{ self .name } ?pk=$pk" ,
379379 columns = [
380380 Column (label = "pk" , name = "pk" ),
381381 Column (label = "label" , name = "label" ),
@@ -388,11 +388,11 @@ def get_column(self, request: Request) -> Column:
388388 return self ._column
389389
390390 async def get_selects (
391- self ,
392- request : Request ,
393- pk : Optional [str ],
394- perPage : Optional [int ],
395- page : Optional [int ],
391+ self ,
392+ request : Request ,
393+ pk : Optional [str ],
394+ perPage : Optional [int ],
395+ page : Optional [int ],
396396 ):
397397 related_model = self ._field .related_model # type: ignore
398398 if pk is not None :
@@ -525,16 +525,16 @@ def amis_2_orm(self, value: Any) -> Any:
525525
526526
527527def create_column (
528- field_name : str ,
529- field_type : fields .Field ,
530- prefix : str ,
528+ field_name : str ,
529+ field_type : fields .Field ,
530+ prefix : str ,
531531):
532532 if isinstance (field_type , IntEnumFieldInstance ):
533533 return IntEnumControl (field_name , field_type , prefix )
534534 elif isinstance (field_type , CharEnumFieldInstance ):
535535 return StrEnumControl (field_name , field_type , prefix )
536536 elif isinstance (
537- field_type , (fields .IntField , fields .SmallIntField , fields .BigIntField , fields .FloatField )
537+ field_type , (fields .IntField , fields .SmallIntField , fields .BigIntField , fields .FloatField )
538538 ):
539539 return IntControl (field_name , field_type , prefix )
540540 elif isinstance (field_type , fields .TextField ):
0 commit comments