Dont show official contests in home

This commit is contained in:
cuom1999 2024-07-24 17:19:25 +07:00
parent 7aecf6b046
commit 48d0a58dae

View file

@ -51,14 +51,13 @@ class HomeFeedView(FeedView):
now = timezone.now() now = timezone.now()
visible_contests = ( visible_contests = (
Contest.get_visible_contests(self.request.user, show_own_contests_only=True) Contest.get_visible_contests(self.request.user, show_own_contests_only=True)
.filter(is_visible=True) .filter(is_visible=True, official__isnull=True)
.order_by("start_time") .order_by("start_time")
) )
if self.request.organization: if self.request.organization:
visible_contests = visible_contests.filter( visible_contests = visible_contests.filter(
is_organization_private=True, organizations=self.request.organization is_organization_private=True, organizations=self.request.organization
) )
context["current_contests"] = visible_contests.filter( context["current_contests"] = visible_contests.filter(
start_time__lte=now, end_time__gt=now start_time__lte=now, end_time__gt=now
) )