Show icon when boolean field in change_list view of admin with Django-jet

515 Views Asked by At

When showing boolean fields, there's no check/uncheck icon as in the default template of Django Admin. my Admin model

class UserAdmin(UserAdmin):
    list_display = ['username', 'last_name', 'first_name', 'active']
    search_fields = ['username', 'last_name', 'first_name', 'is_active', 'groups']
2

There are 2 best solutions below

0
On BEST ANSWER

To fix, I just had to override a CSS style in style tag, in base.html that I have overridden admin folder, of it:

#changelist-form td.field-active img {
    display: inline-block !important; // we can use also display:block
}
0
On

Thanks to guidance from @ketimaBU i got it working too.

Here's the full solution that worked in my case, using Django==3.0.2 and r-django-jet==2.0.8.

In the project /templates/admin/ folder add a "base.html" file with following content, to override Jet style:

{% extends "admin/base.html" %}

<!-- Show the images for BooleanField -->
{% block extrastyle %}
    <style>
        #changelist-form img {
            display: block; 
        }
    </style>
{% endblock %}