I got this error while running python manage.py makemigrations. I was using the attris in the right way as searched by me in google:
Form fields:
image = forms.ImageField(required=False, widget=forms.FileInput(attris={'class': 'form-control'}))
ethnicity = forms.ChoiceField(choices = ETHINIC_CHOICES, widget=forms.Select(attris={'class': 'nice-select rounded'}))
date_birth = forms.DateField(required=True, widget=forms.FileInput(attris={'class': 'form-control', 'placeholder': 'Enter a date: '}))
sex = forms.ChoiceField(choices = SEX_CHOICES, widget=forms.Select(attris={'class': 'nice-select rounded'}))
marital_status = forms.ChoiceField(choices = MARITAL_STATUS, widget=forms.Select(attris={'class': 'nice-select rounded'}))
addressLine1 = forms.CharField(required=True, widget=forms.TextInput(attris={'class': 'form-control resume', 'placeholder': 'Enter Address Line 1'}))
addressLine2 = forms.CharField(required=True, widget=forms.TextInput(attris={'class': 'form-control resume', 'placeholder': 'Enter Address Line 2'}))
suburb = forms.CharField(required=True, widget=forms.TextInput(attris={'class': 'form-control resume', 'placeholder': 'Enter Suburb'}))
city = forms.CharField(required=True, widget=forms.TextInput(attris={'class': 'form-control resume', 'placeholder': 'Enter City'}))
province = forms.ChoiceField(choices = PROVINCE_CHOICES, widget=forms.Select(attris={'class': 'nice-select rounded'}))
phoneNumber = forms.CharField(required=True, widget=forms.TextInput(attris={'class': 'form-control resume', 'placeholder': 'Enter Phone Number'}))
cover_letter = forms.FileField(required=False, widget=forms.FileInput(attris={'class': 'form-control'}))
cv = forms.FileField(required=False, widget=forms.FileInput(attris={'class': 'form-control'}))
I am getting in the image one but i would assume all are wrong since all are written in the same way
What I have tried:
I searched google and most common response I got was:
attrs is not an argument to the field, it's an argument to the widget.
file = forms.FileField(widget=forms.FileInput(attrs={'class': 'rounded_list'}))
Note that some browsers don't allow the styling of the file input.
Which I was already doing