Initial subdomain implementation

This commit is contained in:
cuom1999 2023-01-23 20:36:44 -06:00
parent dea24f7f71
commit 1628e63084
17 changed files with 194 additions and 46 deletions

View file

@ -71,7 +71,7 @@ class Comment(MPTTModel):
order_insertion_by = ["-time"]
@classmethod
def most_recent(cls, user, n, batch=None):
def most_recent(cls, user, n, batch=None, organization=None):
queryset = (
cls.objects.filter(hidden=False)
.select_related("author__user")
@ -79,6 +79,9 @@ class Comment(MPTTModel):
.order_by("-id")
)
if organization:
queryset = queryset.filter(author__in=organization.members.all())
problem_access = CacheDict(
lambda code: Problem.objects.get(code=code).is_accessible_by(user)
)