Home > OS >  How to add icons or emoji in django admin buttons
How to add icons or emoji in django admin buttons

Time:01-07

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? Here is a screenshot of my button, but it doesnt work like that somehow

enter image description here

This is not all my code as you probably already understood, but above code change_actions is probably what makes the button appear along with other buttons. But I am unsure how to add this ➡️ emoji there, cuz its causing errors

CodePudding user response:

Maybe this is what you want:

from django.utils.html import format_html

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

rotate_left_button.short_description = format_html('{} Rotate left', '⬅️')
  • Related