django-vies
django-vies copied to clipboard
How to change form?
How do I change entry class of VATINField ?
This doesn't works
vat_number = VATINField(validators=[VATINValidator(verify=True, validate=True)], attrs={"class": "form-control"})
Hi @VivienGiraud could you give me a bit more context here? I am afraid I can't follow you.
Hi @codingjoe ,
I can pass html class to forms.py to insert it during forms generation like :
name = forms.CharField( max_length=1024, label=_("Name"), required=True, initial=TrideaBillingAddress.name, widget=forms.TextInput( attrs={ "class": "form-control", "placeholder": _("Last Name First Name"), } ), )
How can I do the same using a VATINField field in forms.py ?
For example email is set like that on our code :
email = forms.EmailField(
max_length=254,
label=_("Email"),
required=True,
widget=forms.EmailInput(
attrs={
"class": "form-control",
"placeholder": _("EmailAddress"),
}
),
)
I would like to do the same on VATField, adding widget attrs to change placeholder or class.
Hi @VivienGiraud this is a good point, currently you can't change the placeholder, at least not without overriding the VATINWidget. It might make sense to forward this attribute to the text input.
Best -Johannes