Ticket #8641: 8641.file-doc.diff
File 8641.file-doc.diff, 1.3 KB (added by , 16 years ago) |
---|
-
django/django/docs/topics/files.txt
96 96 useful -- you can use the global default storage system:: 97 97 98 98 >>> from django.core.files.storage import default_storage 99 >>> from django.core.files.base import ContentFile 99 100 100 >>> path = default_storage.save('/path/to/file', 'new content')101 >>> path = default_storage.save('/path/to/file', ContentFile('new content')) 101 102 >>> path 102 103 u'/path/to/file' 103 104 -
django/django/docs/ref/files/storage.txt
41 41 If there already exists a file with this name ``name``, the storage system may 42 42 modify the filename as necessary to get a unique name. The actual name of the 43 43 stored file will be returned. 44 Also, the given ``content`` has to be a :ref:`Django File <ref-files-file>` 45 object. If you need to save another type of object -- a string for example -- 46 you'll need to first wrap it into a Django File object. 44 47 45 48 ``Storage.delete(name)`` 46 49 ~~~~~~~~~~~~~~~~~~~~~~~~