Thursday, October 31, 2013

ValidationError code attribute

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

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7988fe19-3a8e-4afe-ba9b-3c72b7824a66%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment