This commit is contained in:
Dmitry Belan
2026-09-19 11:43:07 +03:00
commit 0e11a41d29
47 changed files with 1631 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
import os
from django.core.exceptions import ValidationError
def validate_file_extension(value):
ext = os.path.splitext(value.name)[1]
valid_extensions = ['.pdf', '.jpg', '.jpeg', '.png']
if not ext.lower() in valid_extensions:
raise ValidationError('Unsupported file extension. Only PDF, JPG, and PNG are allowed.')