Question: ***forms.py***:

```
from django import forms
from .models import Student

class StudentRegistraion(forms.ModelForm):
    class Meta:
        model = Student
        fields = ['name', 'roll_num', 'email', 'password']
        widgets = {
            'name': forms.CharField(attrs={'class': 'form-control'}),
            'roll_num': forms.IntegerField(attrs={'class': 'form-control'}),
            'email': forms.EmailInput(attrs={'class': 'form-control'}),
            'password': forms.PasswordInput(attrs={'class': 'form-control'}),

        }

```

Answer: 
A [*form field* [Django-doc]](https://docs.djangoproject.com/en/3.0/ref/forms/fields/) has no [**`attrs=…`** parameter [Django-doc]](https://docs.djangoproject.com/en/3.0/ref/forms/widgets/#django.forms.Widget.attrs). A [*form widget* [Django-doc]](https://docs.djangoproject.com/en/3.1/ref/forms/widgets/) has.

The default widget of a [**`CharField`** [Django-doc]](https://docs.djangoproject.com/en/3.1/ref/forms/fields/#charfield) is a [**`TextInput`** [Django-doc]](https://docs.djangoproject.com/en/3.1/ref/forms/widgets/#django.forms.TextInput). For an [**`IntegerField`** [Django-doc]](https://docs.djangoproject.com/en/3.1/ref/forms/fields/#integerfield) a [**`NumberInput`** [Django-doc]](https://docs.djangoproject.com/en/3.1/ref/forms/widgets/#django.forms.NumberInput). The `EmailInput` and `PasswordInput` objects are widgets. So we can use the default widgets (or other widgets if you want):

```
class StudentRegistration(forms.ModelForm):
    class Meta:
        model = Student
        fields = ['name', 'roll_num', 'email', 'password']
        widgets = {
            'name': forms.**TextInput(**attrs={'class': 'form-control'}**)**,
            'roll_num': forms.**NumberInput(**attrs={'class': 'form-control'}**)**,
            'email': forms.EmailInput(attrs={'class': 'form-control'}),
            'password': forms.PasswordInput(attrs={'class': 'form-control'}),
        }
```
You use **the form fields [forms.CharField()](https://docs.djangoproject.com/en/4.0/ref/forms/fields/#charfield) and [forms.IntegerField()](https://docs.djangoproject.com/en/4.0/ref/forms/fields/#integerfield)** for **"widgets"** which is wrong:

```py
widgets = {
    'name': forms.CharField(attrs={'class': 'form-control'}), # Wrong
    'roll_num': forms.IntegerField(attrs={'class': 'form-control'}), # Wrong
    # ...
}

```

So, instead, you need to use **the widgets [forms.TextInput()](https://docs.djangoproject.com/en/4.0/ref/forms/widgets/#textinput) and [forms.NumberInput()](https://docs.djangoproject.com/en/4.0/ref/forms/widgets/#numberinput)** for **"widgets"** which is correct:

```py
widgets = {
    'name': forms.TextInput(attrs={'class': 'form-control'}), # Correct
    'roll_num': forms.NumberInput(attrs={'class': 'form-control'}), # Correct
    # ...
}

```