Forum attachments

The forum_attachments application handles all the attachments that can be associated with forum posts.

Abstract models

class machina.apps.forum_conversation.forum_attachments.abstract_models.AbstractAttachment(*args, **kwargs)

Bases: django.db.models.base.Model

Represents a post attachment. An attachment is always linked to a post.


class machina.apps.forum_conversation.forum_attachments.cache.AttachmentCache

Bases: object

The attachments cache. This one should be used with a FileBasedCache backend. But this can be overriden. The attachments cache acts as a wrapper and ensure that the states (name, size, content type, charset and content) of all files from any request.FILES dict are saved inside the considered backend when calling the ‘set’ method. Conversely, the ‘get’ method will populate a dictionary of InMemoryUploadedFile instances or TemporaryUploadedFile instancesby using these states.


Regenerates a MultiValueDict instance containing the files related to all file states stored for the given key.

set(key, files)

Stores the state of each file embedded in the request.FILES MultiValueDict instance. This instance is assumed to be passed as the ‘files’ argument. Each state stored in the cache is a dictionary containing the following values:

The name of the uploaded file.
The size of the uploaded file.
The content type of the uploaded file.
The content length of the uploaded file.
The charset of the uploaded file.
The content of the uploaded file.


class machina.apps.forum_conversation.forum_attachments.views.AttachmentView(**kwargs)

Bases: machina.apps.forum_permission.viewmixins.PermissionRequiredMixin, django.views.generic.detail.DetailView

Allows to retrieve a forum attachment.


alias of Attachment