如何为 Django 管理员 change_list 中的列提供 CSS 类 [英] How to give a column in the Django admin change_list a CSS class

查看:11
本文介绍了如何为 Django 管理员 change_list 中的列提供 CSS 类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I'd like to change the column widths in the list display of the Django admin.

Is it possible somehow to add a CSS classname to a column? I'd preferably not overwrite the entire template to accomplish this.

解决方案

In Django >= 1.6, CSS classes are included with list_display output:

"The field names in list_display will also appear as CSS classes in the HTML output, in the form of column-<field_name> on each <th> element. This can be used to set column widths in a CSS file."

这篇关于如何为 Django 管理员 change_list 中的列提供 CSS 类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆