API

DynamicFile

class dynamic_file.models.DynamicFile(id, display_name, description, uploaded_by, created_at, updated_at, file)
exception DoesNotExist
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception MultipleObjectsReturned
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

created_at

Read-only field, specifying the upload date of this file.

description

A concise and optional description of the uploaded file.

display_name

A concise and optional description of the uploaded file.

file

The concrete file for this model.

property mimetype

Guesses the mimetype from the file extension. Returns null if unknown

property name

Returns the filename of this instance. If file is None, an empty string is returned.

property read

Wrapper for the read method of the FileField instance

to_base64()

Converts the file to base64. Undefined if the file is None

to_base64_src()

Converts the file to base64 and returns it in utf-8 encoding. In addition, the content is wrapped to be used within html src= attributes

to_base64_utf8()

Converts the file to base64 and returns it in utf-8 encoding.

updated_at

Read-only field, specifying the update date of this file.

uploaded_by

Specifies the uploader of this file. This foreign key defaults to AUTH_USER_MODEL but can be customized by changing DYNAMIC_FILE_UPLOADED_BY_MODEL. The reverse accessor is unused.

NOTE: Changing those settings is only supported _before_ running the first migration