Clean up more sql queries
This commit is contained in:
parent
571596dcbf
commit
bf5514032b
16 changed files with 356 additions and 358 deletions
|
@ -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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue