[Django]-How to change True value into green check in the Django admin ListView

5👍

The correct way is to set a boolean attribute on the method itself. You should also make sure the method always returns a bool.

def image_tag(self):
    return bool(self.main_image)
image_tag.boolean = True

(This is documented, but there’s no way to link to the exact place: see about halfway through the list_display section.)

Leave a comment