在我的django admin中,使用danger
类创建错误消息(使用消息框架)。但是,该消息看起来是绿色的,并在其上签名:
在查看admin/css/base.css
时,错误类似乎是error
而不是danger
。
为什么显示为danger
?我怎样才能改变它?
答案 0 :(得分:3)
没有名为 danger 的消息级别。您可以使用的是warning
或error
:
https://docs.djangoproject.com/en/1.11/ref/contrib/messages/#message-levels
DEBUG Development-related messages that will be ignored (or removed)
in a production deployment
INFO Informational messages for the user
SUCCESS An action was successful, e.g. “Your profile was updated successfully”
WARNING A failure did not occur but may be imminent
ERROR An action was not successful or some other failure occurred