def get_attachment_formset_kwargs(self):
        """
        Returns the keyword arguments for instantiating the attachment formset.
        """
        kwargs = {
            'prefix': 'attachment',
        }

        if self.request.method in ('POST', 'PUT'):
            kwargs.update({
                'data': self.request.POST,
                'files': self.request.FILES,
            })
        else:
            post = self.get_post()
            attachment_queryset = Attachment.objects.filter(post=post)
            kwargs.update({
                'queryset': attachment_queryset,
            })
        return kwargs
dataset/ETHPy150Open ellmetha/django-machina/machina/apps/forum_conversation/views.py/BasePostFormView.get_attachment_formset_kwargs/original