code: def get_attachment_formset_kwargs(self):
          
          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
docs: Returns the keyword arguments for instantiating the attachment formset.