Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

widget attrs doesn't work #144

Open
shuai336 opened this issue Jun 13, 2018 · 3 comments
Open

widget attrs doesn't work #144

shuai336 opened this issue Jun 13, 2018 · 3 comments

Comments

@shuai336
Copy link

captcha = CaptchaField(error_messages={ widget=CaptchaTextInput(attrs={'placeholder': message}))
the placeholder doesn't work

@mbi
Copy link
Owner

mbi commented Jun 13, 2018

@ziima this might be in the realm of your recent changes, what is your take on this?

@shuai336
Copy link
Author

shuai336 commented Jun 13, 2018

I just want add a placeholder at the captcha field

captcha = CaptchaField(error_messages={'invalid': e_message},
widget=CaptchaTextInput(attrs={'placeholder': p_message},
output_format=u'%(hidden_field)s %(text_field)s %(image)s'))

the output_format is ok, but the placeholder doesn't work

@ziima
Copy link
Contributor

ziima commented Jun 20, 2018

Using django-simple-captcha 0.5.7, django 1.11 and python 2.7 following works for me:

from django import forms
from captcha.fields import CaptchaField, CaptchaTextInput

class MyForm(forms.Form):
    captcha = CaptchaField(widget=CaptchaTextInput(attrs={'placeholder': 'SMEGHEAD!'}))

form = MyForm()
unicode(form)

@shuai336 I'm not entirely sure how your form looks like, but output_format is now deprecated in favor of template based rendering. One of the reasons was to fix the behavior of widget attributes. Edit: I got it, once I submitted the comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants