Assigning a Class for a label in the Django forms

Viewed 145

I am trying to add a class for label in a custom django form. I am able to add class to the input but for the labels I have been struggling for a while:

Here is the form:

class infoForm(ModelForm):
    class Meta:
        model = Info
        fields = ['businessName']
        widgets={
            'businessName':forms.TextInput(attrs={"class": 'form-control'}),
        }
        labels = {
            'businessName': 'Business Name',
        }

Here is the model

class Info(models.Model):
    businessName = models.CharField(max_length=100)

My question:

How to add the class form-label inside the label of every input? Thank you

0 Answers
Related