python - How to get the default text of a Django form field validation error message? -



python - How to get the default text of a Django form field validation error message? -

i'm writing unit tests django application using test client (django.test.client.client).

i have page on application form contains emailfield. in unit test, want submit form info containing invalid email address, , inspect response content verify contains error message text invalid email address.

but how know text for?

in general, how default error messages particular field type?

i came this:

>>> django.core.validators import emailvalidator >>> emailvalidator.message.strip() u'enter valid email address.'

it satisfies immediate need, seems there should improve solution.

python django django-forms

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -