I have a django form where I have certain fields. Now I want to add some styling to it (bootstrap mostly). But it does not seem to be working.
In my forms.py file
from django import forms
from django.core.validators import FileExtensionValidator
file_type_choices = [
('CSV', 'Comma-Separated Values'),
('TSV', 'Tab-Separated Values')
]
valid_extensions = ['.tsv', '.csv']
class FileUploadForm(forms.Form):
file = forms.FileField(allow_empty_file=False, \
validators=[FileExtensionValidator(allowed_extensions=valid_extensions)])
file_type = forms.ChoiceField(choices=file_type_choices, widget=forms.Select(attrs={"class": "form-control"}))
source_language = forms.CharField(max_length=30,\
widget=forms.TextInput(attrs={"class":"form-control", "placeholder": "English"}))
target_language = forms.CharField(max_length=30, \
widget=forms.TextInput(attrs={"class":"form-control"}))
I also added bootstrap CDN links in the templates. And just for surety, added the following in settings.py file of the project:
python CRISPY_TEMPLATE_PACK = 'bootstrap5'
Also, its curious to see that placeholder is also not working.
I don't see particular reason behind this.