Pretty nice commit overall, made the upload mechanic much more realistic and usable. Only thing left for the upload is the user id assignment. Check new ideas in discord.
This commit is contained in:
15
website/upload/validators.py
Normal file
15
website/upload/validators.py
Normal file
@ -0,0 +1,15 @@
|
||||
def imageValidate(value):
|
||||
import os
|
||||
from django.core.exceptions import ValidationError
|
||||
ext = os.path.splitext(value.name)[1]
|
||||
valid_extensions = ['.jpg', '.png', '.gif']
|
||||
if not ext.lower() in valid_extensions:
|
||||
raise ValidationError('Unsupported file extension.')
|
||||
|
||||
def videoValidate(value):
|
||||
import os
|
||||
from django.core.exceptions import ValidationError
|
||||
ext = os.path.splitext(value.name)[1]
|
||||
valid_extensions = ['.mp4', '.mkv', '.avi']
|
||||
if not ext.lower() in valid_extensions:
|
||||
raise ValidationError('Unsupported file extension.')
|
Reference in New Issue
Block a user