def post(self, request, *args, **kwargs):
        """ Handles POST requests. """
        self.init_attachment_cache()

        # Stores a boolean indicating if we are considering a preview
        self.preview = 'preview' in self.request.POST

        # Initializes the forms
        post_form_class = self.get_post_form_class()
        post_form = self.get_post_form(post_form_class)
        attachment_formset_class = self.get_attachment_formset_class()
        attachment_formset = self.get_attachment_formset(attachment_formset_class)

        self.attachment_preview = (
            self.preview if attachment_formset and attachment_formset.is_valid() else None
        )

        post_form_valid = post_form.is_valid()
        if (
            (post_form_valid and attachment_formset is None) or
            (post_form_valid and attachment_formset.is_valid())
        ):
            return self.form_valid(post_form, attachment_formset)
        else:
            return self.form_invalid(post_form, attachment_formset)