Skip to content

How can I change the default error messages? #251

Answered by manikos
CaioCamatta asked this question in Q&A
Discussion options

You must be logged in to vote

Here's a peak at my code which overrides the default error messages:

# forms.py

from captcha.fields import ReCaptchaField
from django.utils.translation import ugettext_lazy as _

captcha = ReCaptchaField(attrs={'size': 'normal', 'callback': 'captchaCallback'}, 
error_messages={'required': _("You're not a robot, right?")})
# submit_form.html

...
{% if my_form.captcha.errors %}
    <div class="my_form_error my-captcha-error">{{ my_form.captcha.errors }}</div>
{% endif %}
<span>{{ my_form.captcha }}</span>

It works great on me.

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by thibaudcolas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #118 on January 26, 2022 21:33.