Commit b618269fba2846790b44951ae77d284e0301f1ee
1 parent
043747d6
Exists in
master
and in
3 other branches
Fixed error message in file_link creation
Showing
1 changed file
with
2 additions
and
2 deletions
Show diff stats
file_link/models.py
@@ -17,10 +17,10 @@ def validate_file_extension(value): | @@ -17,10 +17,10 @@ def validate_file_extension(value): | ||
17 | 'application/vnd.oasis.opendocument.spreadsheet','application/vnd.oasis.opendocument.text', | 17 | 'application/vnd.oasis.opendocument.spreadsheet','application/vnd.oasis.opendocument.text', |
18 | 'application/pdf' | 18 | 'application/pdf' |
19 | ] | 19 | ] |
20 | - | 20 | + |
21 | if hasattr(value.file, 'content_type'): | 21 | if hasattr(value.file, 'content_type'): |
22 | if not value.file.content_type in valid_formats: | 22 | if not value.file.content_type in valid_formats: |
23 | - raise ValidationError(_('File not supported.')) | 23 | + raise ValidationError(_('Please select a valid file. The uploaded file must have one of the following extensions: .doc, .docx, .html, .jpg, .odp, .ods, .odt, .pdf, .png, .ppt, .pptx, .xlx e .xlsx')) |
24 | 24 | ||
25 | class FileLink(Resource): | 25 | class FileLink(Resource): |
26 | file_content = models.FileField(_('File'), blank = True, upload_to = 'files/', validators = [validate_file_extension]) | 26 | file_content = models.FileField(_('File'), blank = True, upload_to = 'files/', validators = [validate_file_extension]) |