Alternative queryset

This commit is contained in:
2026-09-09 20:44:14 +02:00
parent a17f9241f4
commit 01c546fd0a
+6 -4
View File
@@ -164,11 +164,13 @@ class UECommentQuerySet(models.QuerySet):
Q(reports=None) Q(reports=None)
| Q(author=user) | Q(author=user)
| Q( | Q(
reports__in=UECommentReport.objects.filter( Exists(
comment=OuterRef("pk"), reporter__in=[user] UECommentReport.objects.filter(
).all() comment=OuterRef("pk"), reporter=user
)
)
)
) )
).distinct()
return self.filter(author=user) return self.filter(author=user)
def annotate_is_reported(self) -> Self: def annotate_is_reported(self) -> Self: