Skip to content

Commit b50e350

Browse files
committed
Added get_object_actions() function
Can use context['original'] (the model) to return dynamic objectactions. Note that this won't affect the url setup -- modeladmin.objectactions should include all possible actions.
1 parent 8909177 commit b50e350

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

django_object_actions/utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,13 @@ def to_dict(tool_name):
4747
custom_attrs=custom_attrs,
4848
)
4949

50-
context['objectactions'] = [to_dict(x) for x in self.objectactions]
50+
context['objectactions'] = [to_dict(x) for x in self.get_object_actions(request, context, **kwargs)]
5151
return super(BaseDjangoObjectActions, self).render_change_form(request,
5252
context, **kwargs)
53+
54+
55+
def get_object_actions(self, request, context, **kwargs):
56+
return self.objectactions
5357

5458
##################
5559
# CUSTOM METHODS #

0 commit comments

Comments
 (0)