Fix contest display on home
This commit is contained in:
parent
309b6298e2
commit
0650223d10
1 changed files with 7 additions and 4 deletions
|
@ -546,7 +546,7 @@ class Contest(models.Model):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_visible_contests(cls, user, show_own_contests_only=False):
|
def get_visible_contests(cls, user, show_own_contests_only=False):
|
||||||
if not user.is_authenticated or show_own_contests_only:
|
if not user.is_authenticated:
|
||||||
return (
|
return (
|
||||||
cls.objects.filter(
|
cls.objects.filter(
|
||||||
is_visible=True, is_organization_private=False, is_private=False
|
is_visible=True, is_organization_private=False, is_private=False
|
||||||
|
@ -556,9 +556,12 @@ class Contest(models.Model):
|
||||||
)
|
)
|
||||||
|
|
||||||
queryset = cls.objects.defer("description")
|
queryset = cls.objects.defer("description")
|
||||||
if not (
|
if (
|
||||||
user.has_perm("judge.see_private_contest")
|
not (
|
||||||
or user.has_perm("judge.edit_all_contest")
|
user.has_perm("judge.see_private_contest")
|
||||||
|
or user.has_perm("judge.edit_all_contest")
|
||||||
|
)
|
||||||
|
or show_own_contests_only
|
||||||
):
|
):
|
||||||
q = Q(is_visible=True)
|
q = Q(is_visible=True)
|
||||||
q &= (
|
q &= (
|
||||||
|
|
Loading…
Reference in a new issue