'use django admins icons for my own fields

What is the best way to use the standard django icons from the admin menu in custom fields for the admin?

enter image description here

I know they are stored in projectname-static/admin/img/icon-alert.svg etc ... but is there something like from django.templatetags.static import static where I can access them?

I know they are implemented in the admin using css:

ul.messagelist li.warning {
background: var(--message-warning-bg) url(../img/icon-alert.svg) 40px 14px no-repeat;
background-size: 14px auto;
}

I imagine something like:

class CustomFieldAdmin(admin.ModelAdmin):
    fields = ["custom",]

    def custom(self, obj):
        return format_html(f"""<img src="{icon}">obj.text""")


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source