Reputation: 2078
I would like to use multiple widgets on 1 form field in django.
password = forms.CharField(required=True,
widget=forms.PasswordInput,
widget=forms.TextInput(attrs={'placeholder': 'Password:'}))
When I use it like this, i get the error: "keyword argument repeated " I understand that I am using widget= twice, but I cant figure out how else to do it
Upvotes: 0
Views: 7024
Reputation: 1459
PasswordInput extends TextInputt so you can simply do it like this:
password = forms.CharField(required=True, widget=forms.PasswordInput(attrs={'placeholder': 'Password:'}))
Upvotes: 6