diff options
| author | Abhaya Agarwal <abhaya@instascribe.com> | 2015-05-03 09:40:24 +0530 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-05-12 20:08:22 -0400 |
| commit | 9de9c240178bd9f61f55dad07e76ea458f0291f5 (patch) | |
| tree | 8c5f57b6b0bead575fdb3b7243d241da1bc80cf8 /docs | |
| parent | 7c7b85510656cc814814b85bc52201bbd91821a9 (diff) | |
Fixed #24105 -- Called Storage.get_valid_name() when upload_to is callable
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/howto/custom-file-storage.txt | 12 | ||||
| -rw-r--r-- | docs/releases/1.9.txt | 4 |
2 files changed, 12 insertions, 4 deletions
diff --git a/docs/howto/custom-file-storage.txt b/docs/howto/custom-file-storage.txt index a6c8745462..5140911591 100644 --- a/docs/howto/custom-file-storage.txt +++ b/docs/howto/custom-file-storage.txt @@ -88,9 +88,15 @@ instead). .. method:: get_valid_name(name) Returns a filename suitable for use with the underlying storage system. The -``name`` argument passed to this method is the original filename sent to the -server, after having any path information removed. Override this to customize -how non-standard characters are converted to safe filenames. +``name`` argument passed to this method is either the original filename sent to +the server or, if ``upload_to`` is a callable, the filename returned by that +method after any path information is removed. Override this to customize how +non-standard characters are converted to safe filenames. + +.. versionchanged:: 1.9 + + In older versions, this method was not called when ``upload_to`` was a + callable. The code provided on ``Storage`` retains only alpha-numeric characters, periods and underscores from the original filename, removing everything else. diff --git a/docs/releases/1.9.txt b/docs/releases/1.9.txt index 25868dafd3..473e64f95d 100644 --- a/docs/releases/1.9.txt +++ b/docs/releases/1.9.txt @@ -141,7 +141,9 @@ Email File Storage ^^^^^^^^^^^^ -* ... +* :meth:`Storage.get_valid_name() + <django.core.files.storage.Storage.get_valid_name>` is now called when + the :attr:`~django.db.models.FileField.upload_to` is a callable. File Uploads ^^^^^^^^^^^^ |
