class documentation

class FileDescriptor(DeferredAttribute):

Known subclasses: django.db.models.fields.files.ImageFileDescriptor

View In Hierarchy

The descriptor for the file attribute on the model instance. Return a FieldFile when accessed so you can write code like:

>>> from myapp.models import MyModel
>>> instance = MyModel.objects.get(pk=1)
>>> instance.file.size

Assign a file object on assignment so you can do:

>>> with open('/path/to/hello.world') as f:
...     instance.file = File(f)
Method __get__ Retrieve and caches the value from the datastore on the first lookup. Return the cached value.
Method __set__ Undocumented

Inherited from DeferredAttribute:

Method __init__ Undocumented
Method ​_check​_parent​_chain Check if the field value can be fetched from a parent field already loaded in the instance. This can be done if the to-be fetched field is a primary key field.
Instance Variable field Undocumented
def __get__(self, instance, cls=None):
Retrieve and caches the value from the datastore on the first lookup. Return the cached value.
def __set__(self, instance, value):