fairdm.core.image_utils#

Shared image upload help text, size limit and validator for the core models.

Module Contents#

Functions#

validate_image_file_size

Reject an uploaded file larger than MAX_IMAGE_UPLOAD_BYTES.

Data#

API#

MAX_IMAGE_UPLOAD_BYTES#

None

IMAGE_HELP_TEXT#

‘_(…)’

validate_image_file_size(file)[source]#

Reject an uploaded file larger than MAX_IMAGE_UPLOAD_BYTES.

Args: file: An uploaded file object with a size attribute (bytes).

Raises: ValidationError: The uploaded file is larger than 5 MB. The message includes the actual size in MB.