How to add icons or emoji in django admin buttons

Question:

So I have some buttons in django admin and I need to add something like that: ⬅️➡️↩️↪️ to my admin buttons, but I have 0 idea how to do this and I feel like I am the first ever person to ask that question on the internet, google didnt help :)) Can you guys suggest something?

Asked By: oikawatoru

||

Answers:

Maybe this is what you want:

from django.utils.html import format_html

def rotate_left_button(self, request, queryset):
    return format_html('<button class="button">{} Rotate left</button>', '⬅️')

rotate_left_button.short_description = format_html('{} Rotate left', '⬅️')
Answered By: Wariored