Justin Qian

Results 11 comments of Justin Qian

I agree with you. The logic behind the design is to execute the submit-line actions after the object is saved, along with which one implication is that all the relations...

Hi Lukas, Great thanks for your prompt reply. I'm so sorry for my delayed response. Been crazy busy lately. Before giving you a simple yes or no, I might need...

Hi Lukas, I've submitted PR https://github.com/unfoldadmin/django-unfold/pull/90. Please have a look when you feel free. Happy to discuss further if any questions raised. Cheers, Justin

This is the same to https://github.com/unfoldadmin/django-unfold/issues/267

You may get the object id from request.path. ``` try: obj_id = int(request.path.split("/")[-3]) except: pass ``` Apart from this, you can “hide” unwanted actions in a formview by overriding get_actions_detail...

Here's an example for your reference. ``` @admin.register(YourModel) class YourModelAdmin(ModelAdmin actions_detail = ["action_one"] @action(description=("One"), permissions=["add"], url_path="one", attrs={}) def action_one(self, request: HttpRequest, object_id: int): # your business logics pass def get_actions_detail(self,...

Another way is to create your own has_xxxx_permission method. ``` @admin.register(YourModel) class YourModelAdmin(ModelAdmin actions_detail = ["action_one"] @action(description=("One"), permissions=["approve"], url_path="one", attrs={}) def action_one(self, request: HttpRequest, object_id: int): # your business logics...