[Answered ]-How to make the captcha have a bootstrap class?

1👍

I haven’t verified this, but you might try:

from captcha.fields import CaptchaField, CaptchaTextInput

class RegisterForm(UserCreationForm):
   captcha=CaptchaField(widget=CaptchaTextInput(attrs={'class': 'form-control'}))

Not sure if widget_tweaks plays nicely with MultiValueFields, but you could also try in your templates.

{% render_field form.captcha class+="form-control" %}

(Note the += rather than =)

Or, again using widget_tweaks

{{ form.captcha|add_class:"form-control" }}

Leave a comment