Skip to content

Instantly share code, notes, and snippets.

@jacobpledger
jacobpledger / validators.py
Last active October 3, 2017 19:38 — forked from jrosebr1/validators.py
Validator for files, checking the size, extension and mimetype for Django.
import mimetypes
from os.path import splitext
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import filesizeformat
class FileValidator(object):
"""