Commit 21a80cc3 authored by Diederik van der Boor's avatar Diederik van der Boor
Browse files

Add logger statement to see the content type of rejected uploads

parent 2b1d0347
#-*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import os
import django
......@@ -11,6 +13,9 @@ from django.utils.encoding import smart_str
from django.utils.translation import ugettext_lazy as _
from .storage import private_storage
logger = logging.getLogger(__name__)
class PrivateFileField(models.FileField):
"""
......@@ -45,6 +50,7 @@ class PrivateFileField(models.FileField):
content_type = file.content_type
if self.content_types and content_type not in self.content_types:
logger.debug('Rejected uploaded file type: %s', content_type)
raise ValidationError(self.error_messages['invalid_file_type'])
if self.max_file_size and file.size > self.max_file_size:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment