oioioi.filetracker.fields
¶
Module Contents¶
Classes¶
A mixin class used to forward file methods to an underlaying file |
|
The descriptor for the file attribute on the model instance. Return a |
|
A |
- class oioioi.filetracker.fields.FieldFile(instance, field, name)[source]¶
Bases:
django.db.models.fields.files.FieldFile
A mixin class used to forward file methods to an underlaying file object. The internal file object has to be called “file”:
class FileProxy(FileProxyMixin): def __init__(self, file): self.file = file
- class oioioi.filetracker.fields._FileDescriptor(field)[source]¶
Bases:
django.db.models.fields.files.FileDescriptor
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)
- class oioioi.filetracker.fields.FileField(*args, **kwargs)[source]¶
Bases:
django.db.models.fields.files.FileField
A
FileField
with fixtures support.Default value of max_length is increased from 100 to 255.
Values of
FileFields
are serialized as:data:<filename>:<base64-encoded data>
It is also possible to decode a more human-friendly representaion:
data:<filename>:raw:<raw data>
but this works only for ASCII content.