在Django管理列表中更改行颜色 [英] Change row colour in Django Admin List

查看:354
本文介绍了在Django管理列表中更改行颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Django管理页面(change_list.html)中基于称为状态的模型中的字段来突出显示行(设置后退颜色)。什么是最好的方法?

I want to highlight rows (set the backgorund colour) in the Django Admin page (change_list.html) based on a field in the model called status. What is the best way to do this?

我有3个状态。打开,活动,关闭。我想要打开的行是绿色的,活跃的是橙色,关闭为红色。

I have 3 statuses. Open, Active, Closed. I'd like rows with open to be green, active to be orange and closed to be red.

我发现关于更改模板的文档,但不确定如何检查状态以便对该行进行着色。

I've found documentation about changing the templates so but not sure how to check the status to colour the row.

推荐答案

查看 django-liststyle

这篇关于在Django管理列表中更改行颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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