Clean up more sql queries

This commit is contained in:
cuom1999 2024-04-26 20:37:35 -05:00
parent 571596dcbf
commit bf5514032b
16 changed files with 356 additions and 358 deletions

View file

@ -73,12 +73,7 @@ class Comment(MPTTModel):
@classmethod
def most_recent(cls, user, n, batch=None, organization=None):
queryset = (
cls.objects.filter(hidden=False)
.select_related("author__user")
.defer("author__about")
.order_by("-id")
)
queryset = cls.objects.filter(hidden=False).order_by("-id")
if organization:
queryset = queryset.filter(author__in=organization.members.all())