I\'m working on improving the admin.py in a django project, and while I\'m not totally jazzed about how the table was coming out with three fields in the list_diplay, at lea
You may want to refer to this: https://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-vs-replacing-an-admin-template
basically, the change_list.html needs to be overridden .
you can do it this way:
templates/
admin/
app/
change_list.html
you can obtain a copy of change_list.html from django/contrib/admin/templates/admin/
and update the css the way you desire.
admin.py:
class MyClassAdmin(admin.ModelAdmin):
class Media:
css = {
'all': ('fancy.css')
}
fancy.css:
.column-foo {
width: 20px;
}
where "foo" is a field name.
Source: https://docs.djangoproject.com/en/3.0/topics/forms/media/