def METHOD_NAME(self, ids):
    if not ids:
        return []
    queryset = (
        self.context["user"]
        .attachment_set.select_related("filetype")
        .filter(post__isnull=True, id__in=ids)
    )
    return list(queryset)