db.models.fields.files.FieldFile

class FieldFile [source]

When you access a FileField on a model, you are given an instance of FieldFile as a proxy for accessing the underlying file.

The API of FieldFile mirrors that of File, with one key difference: The object wrapped by the class is not necessarily a wrapper around Python’s built-in file object. Instead, it is a wrapper around the result of the Storage.open() method, which may be a File object, or it may be a custom storage’s implementation of the File API.

In addition to the API inherited from File such as read() and write(), FieldFile includes several methods that can be used to interact with the underlying file:

Warning

Two methods of this class, save() and delete(), default to saving the model object of the associated FieldFile in the database.

doc_Django
2016-10-09 18:35:32
Comments
Leave a Comment

Please login to continue.