[Fixed]-How to add a class with django form lable

1👍

You can use form init method to call class

class YourForm(forms.Form)
def __init__(self, *args, **kwargs):
    super(YourForm, self).__init__(*args, **kwargs)
    self.fields['field_name'].widget.attrs['class'] = 'your_class'
👤gamer

Leave a comment