开发者

Django: Get the error messages of a form field

开发者 https://www.devze.com 2023-03-03 00:36 出处:网络
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:

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

精彩评论

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