Django: FileField name special chars replaced automatically
<p>My model:</p>

<pre><code>class MyFile(models.Model):
    file = models.FileField(upload_to="myfiles", max_length=500)
    slug = models.SlugField(max_length=500, blank=True)
</code></pre>

<p>When file names contain special chars, such as ' '(space), special chars will be replaced by underscore automatically. 
<strong>Where (in which function) does this happen?</strong> How to disable this automatic validation?</p>

<p>Thanks</p>

<p><strong>UPDATE</strong></p>

<p><strong>Any comments on the following codes?</strong> Thanks</p>

<pre><code>"""
https://docs.djangoproject.com/en/1.9/_modules/django/core/files/storage/#Storage.get_valid_name
Overwrite get_valid_name() function, 
"""
class OverwriteStorage(FileSystemStorage): 
    def get_valid_name(self, name):
        print "name=", name
        return name

class MyFile(models.Model):
    file = models.FileField(upload_to="myfiles", max_length=500, storage=OverwriteStorage())
</code></pre>