Initial isort configuration

Will fail build if imports are not sorted correctly
This commit is contained in:
Martin Whitehouse
2022-07-22 03:26:41 +02:00
parent 12bb68d5ee
commit 25542f929e
57 changed files with 330 additions and 280 deletions

View File

@ -2,16 +2,18 @@
#
# validators for file uploads, etc.
from django.conf import settings
# TODO: can we use the builtin Django validator instead?
# see:
# https://docs.djangoproject.com/en/4.0/ref/validators/#fileextensionvalidator
def validate_file_extension(value):
import os
from django.core.exceptions import ValidationError
import os
ext = os.path.splitext(value.name)[1] # [0] returns path+filename
# TODO: we might improve this with more thorough checks of file types
# rather than just the extensions.