额外动作
There are three kinds of action, toolbar action
show in right top of table header, action
show in end of table
row, bulk action
show in left top of table header.
The format request link of Action
is /{resource}/action/{action_name}/{pk}
, BulkAction
is /{resource}/bulk_action/{action_name}
,ToolbarAction
is /{resource}/toolbar_action/{action_name}
.
Action
class Action(BaseModel):
icon: str
label: str
name: str
method: enums.Method = enums.Method.POST
ajax: bool = True
@validator("ajax")
def ajax_validate(cls, v: bool, values: dict, **kwargs):
if not v and values["method"] != enums.Method.GET:
raise ValueError("ajax is False only available when method is Method.GET")
ToolbarAction
class ToolbarAction(Action):
class_: Optional[str]
最后更新:
July 7, 2023 09:36:36