0.0.15 block plugin

This commit is contained in:
SDE
2023-11-27 18:49:55 +03:00
parent 1234bc569b
commit 5f0a6bfc0a
17 changed files with 455 additions and 81 deletions

8
GeneralApp/validators.py Normal file
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 = ['.jpg', '.jpeg', '.png', '.svg']
if not ext.lower() in valid_extensions:
raise ValidationError('Unsupported file extension.')