beat.web.common.storage module

class beat.web.common.storage.OverwriteStorage(*args, **kwargs)[source]

Bases: django.core.files.storage.FileSystemStorage

get_available_name(name, max_length=None)[source]

Returns a filename that’s free on the target storage system, and available for new content to be written to.

delete(name)[source]

Deletes the specified file from the storage system.

beat.web.common.storage.get_file_content(instance, attr)[source]

Reads the contents of a Django-FileField attribute

Parameters:attr (str) – The name of the attribute
Returns:The contents of the file
Return type:str
Raises:AttributeError – If the field does not exist
beat.web.common.storage.set_file_content(instance, attr, filename, value)[source]

Provisionally set the content of a Django-FileField attribute

The file will be created/overwritten by the save() method.

beat.web.common.storage.save_files(instance)[source]

Save the changed files (if necessary)

beat.web.common.storage.rename_file(instance, attr, name)[source]