diff --git a/inline_actions/admin.py b/inline_actions/admin.py index 81e1ad8..fbc362b 100644 --- a/inline_actions/admin.py +++ b/inline_actions/admin.py @@ -105,6 +105,17 @@ def render_inline_actions(self, obj=None): except AttributeError: css_classes = '' + # Add per-object attribute support + attr_handler = getattr( + self, 'get_{}_attr'.format(action_name), None) + if callable(attr_handler): + attribute_properties = attr_handler(obj=obj) + else: + try: + attribute_properties = action_func.attribute_properties + except AttributeError: + attribute_properties = '' + # If the form is submitted, we have no information about the # requested action. # Hence we need all data to be encoded using the action name. @@ -116,10 +127,11 @@ def render_inline_actions(self, obj=None): str(obj.pk) ] buttons.append( - ''.format( + ''.format( '_action__{}'.format('__'.join(action_data)), description, css_classes, + attribute_properties ) ) return mark_safe('
{}
'.format(