diff --git a/participation/forms.py b/participation/forms.py index 0ce2096..c518001 100644 --- a/participation/forms.py +++ b/participation/forms.py @@ -262,7 +262,15 @@ class UploadNotesForm(forms.Form): except UnicodeDecodeError: # This is not UTF-8, grrrr content = data.decode('latin1') - csvfile = csv.reader(StringIO(content)) + for delimiter in [',', ';', '\t', '|']: + if content.split('\n')[0].count(delimiter) > 1: + break + else: + self.add_error('file', + _("Unable to detect the CSV delimiter. Please use a comma-separated file.")) + return cleaned_data + + csvfile = csv.reader(StringIO(content), delimiter=delimiter) self.process(csvfile, cleaned_data) except UnicodeDecodeError: self.add_error('file', _("This file contains non-UTF-8 and non-ISO-8859-1 content. "