Dango Admin custom list_display 'formatting'

Hi everyone,

In the admin I display custom information in the list_display. I display a boolean id a FielField is set for an instance.
It’s working well, but I would like to know if there is a way to display the little green check (or red cross) for the custom information (_pdf_file) like the display an BooleanField ?

class RegulationAdmin(admin.ModelAdmin):

    form = RegulationAdminForm

    def get_queryset(self, request):
        queryset = super().get_queryset(request)
        queryset = queryset.prefetch_related('type', 'sub_code', 'code')
        return queryset
    list_display = ('reference', 'slug', 'type', 'code', '_sub_codes', 'published', 'object', '_pdf_file')
    list_filter = ('type__name', 'published', 'code__name', 'sub_code__name',)
    search_fields = ('internal_id', 'type__name', 'code__name', 'sub_code__name', 'published', 'object',)

    actions = [mark_published, ]

    def _sub_codes(obj):
        _sub_codes = obj.sub_code.all()
        return ' - '.join(str(x.name) for x in _sub_codes)

    def _pdf_file(obj):
        return bool(obj.pdf_file) 

Thanks in advance for the help.

You’re already aware that the list_display variable can refer to a method. That method can return html (e.g. an img tag) rather than just a raw value. See the colored_name example in the list_display docs.

Many thanks!

Much appreciated.