sqladmin icon indicating copy to clipboard operation
sqladmin copied to clipboard

Make `get_attr_value` accessible from formatter

Open okapies opened this issue 3 years ago • 0 comments

Checklist

  • [X] There are no similar issues or pull requests for this yet.

Is your feature related to a problem? Please describe.

I'm writing custom formatters:

class AddressAdmin(ModelAdmin, model=Address):
    ...
    _formatters = {
        Address.user: lambda m, a: formatters.format_user(m.user, a),
    }
    column_formatters = _formatters
    column_formatters_detail = _formatters

but accessing its attribute like m.user everytime in the format function is a bit verbose and error prone. I'd like to use get_attr_value method implemented in ModelAdmin.

Describe the solution you would like.

No response

Describe alternatives you considered

No response

Additional context

No response

okapies avatar Jun 21 '22 10:06 okapies