Table Of Contents

This Page

Storage backends

storage.py

class files.storage.SQLiteStorage(using=None, base_url=None)

This is the database storage for SQLite databases

_open(name, mode='rb')

Return a File object.

_save(name, content)

Do nothing. We are calling a special write_binary signal in the Attachment save() method, which will call the _write_binary() method below, and write the binary file into the Attachment row.

_write_binary(instance, content)

Do the actual writing of binary data to the table. This method is called after the model has been saved, and can therefore be used to insert data based on information which was not accessible in the save method on the model.

class files.storage.PostgreSQLStorage(using=None, base_url=None)

This is the database storage for PostgreSQL databases

_open(name, mode='rb')

Read the file from the database, and return as a File instance.

_save(name, content)

Do nothing. We are calling a special write_binary signal in the Attachment save() method, which will call the _write_binary() method below, and write the binary file into the Attachment row.

Unlink the binary data before deleting

_write_binary(instance, content)

Do the actual writing of binary data to the table. This method is called after the model has been saved, and can therefore be used to insert data based on information which was not accessible in the save method on the model.