开发者

Django: Get the error messages of a form field

Is it possible to the error messages of a form field? I did some digging a开发者_如何学JAVAnd the field has a property error_messages which is a dictionary but the values return:

<django.utils.functional.__proxy__ object at 0x2591d50>

So was wondering how I can get the error message from that? I am trying to add metadata to the data-validate attribute of the field's widget so I can use client side validation.


It seems a translated string. To get the text, just use unicode on it:

unicode(error_message)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜