From ad8c1c5e43dd1f536e280957074f886a792805dd Mon Sep 17 00:00:00 2001 From: Zhao-Linux Date: Mon, 10 Oct 2022 04:36:02 +0700 Subject: [PATCH] Fix admin contests view homepage --- judge/models/contest.py | 4 ++-- judge/views/blog.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/judge/models/contest.py b/judge/models/contest.py index 989c3e4..0e86dad 100644 --- a/judge/models/contest.py +++ b/judge/models/contest.py @@ -536,8 +536,8 @@ class Contest(models.Model): return False @classmethod - def get_visible_contests(cls, user): - if not user.is_authenticated: + def get_visible_contests(cls, user, *args): + if not user.is_authenticated or args == (True,) : return ( cls.objects.filter( is_visible=True, is_organization_private=False, is_private=False diff --git a/judge/views/blog.py b/judge/views/blog.py index 00a899b..4753563 100644 --- a/judge/views/blog.py +++ b/judge/views/blog.py @@ -70,7 +70,7 @@ class FeedView(ListView): now = timezone.now() visible_contests = ( - Contest.get_visible_contests(self.request.user) + Contest.get_visible_contests(self.request.user, True) .filter(is_visible=True) .order_by("start_time") )