cdh.files.db.wrappers module
- class cdh.files.db.wrappers.FileWrapper(file_instance, field, original_filename)[source]
Bases:
File
- DEFAULT_CHUNK_SIZE = 65536
- property closed
- property content_type
- property created_by
- property created_on
- delete(save=True, force=False)[source]
Deletes the file on disk. If save = True, the metadata object will also be deleted. Note: only delete the metadata object if no other DB object is referencing it, otherwise you’ll get nasty Integrity errors!
- Parameters
save – Whether to also delete the metadata in the DB, defaults to True
force – Whether to force a deletion if multiple DB objects still refer to it, defaults to False
- property field
- property file
- get_content_type_display()[source]
Shows the label of the
content_type
. Seeget_FOO_display()
for more information.
- property id
- property modified_on
- property name
- property name_on_disk
- property path
- property pk
- property size
- property url
- property uuid
- class cdh.files.db.wrappers.TrackedFileWrapper(manager: Manager, instance, field: TrackedFileField)[source]
Bases:
PrivateCacheMixin
- __init__(manager: Manager, instance, field: TrackedFileField)[source]
- property all
- property current_file: Optional[FileWrapper]
Tries to retrieve the file representing the ‘current’ value of this field.