# file_validator/forms.py from django import forms class CSVUploadForm(forms.Form): file = forms.FileField(label='Select a CSV file') def clean_file(self): file = self.cleaned_data['file'] # Check if the file is a CSV if not file.name.endswith('.csv'): raise forms.ValidationError("Only CSV files are allowed") return file