django admin 自定义action的message提示

不懂编程的人看到这个标题会不会打我。。。I 服了 U的那种感觉。

django admin里的自定义action很有用,message提示也很友好,但是今天想报一个错,换了网上几种方法,死活都是绿色小勾的成功样式。

self.message_user(request, _('Clone more than one product at a time is not allowed.'),
                              level=messages.ERROR)

那个level屁用没有,查半天后端。。。后来想了下,查查前端?结果发现当设置成messages.ERROR的时候,class为"danger",而我的base.css没有这个样式,只有一个名为"error"的样式,改成如下,搞定。

self.message_user(request, _('Clone more than one product at a time is not allowed.'),
                              level=messages.ERROR,  extra_tags='error')
输入类似这样的地址 "name@something.com"
输入类似这样的地址"http://someaddress.com"
验证码 不区分大小写(看不清)