Django管理员在启动时失败了"危险"类

时间:2017-05-21 22:21:33

标签: python css django twitter-bootstrap django-1.11

在我的django admin中,使用danger类创建错误消息(使用消息框架)。但是,该消息看起来是绿色的,并在其上签名:

enter image description here

在查看admin/css/base.css时,错误类似乎是error而不是danger

为什么显示为danger?我怎样才能改变它?

1 个答案:

答案 0 :(得分:3)

没有名为 danger 的消息级别。您可以使用的是warningerror

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