ValidationError code attribute

21 views
Skip to first unread message

Andrzej Winnicki

unread,
Oct 31, 2013, 5:29:58 PM10/31/13
to django...@googlegroups.com
Hi,

I have a question about handling ValidationErrors in templates. ValidationError allows to pass custom error code to its constructor like this:

ValidationError(_('Error 1'), code='error1'),

But I can't find any way to access this code in template. Actually in forms/forms.py class in Django Framework code when ValidationError is caught, it seems that only the messages are passed to classes responsible for rendering error html content. 

Is there any good way to access this error-codes in templates?

Regards,

Andrzej
Reply all
Reply to author
Forward
0 new messages