fix superuser contest search

This commit is contained in:
zhaospei 2023-02-08 17:22:43 +07:00
parent 2ee279098f
commit 8e6bcd90af

View file

@ -153,6 +153,7 @@ class ContestList(
if "orgs" in self.request.GET and self.request.profile:
try:
self.org_query = list(map(int, request.GET.getlist("orgs")))
if not self.request.user.is_superuser:
self.org_query = [
i
for i in self.org_query
@ -228,6 +229,9 @@ class ContestList(
context["contest_query"] = self.contest_query
context["org_query"] = self.org_query
if self.request.profile:
if self.request.user.is_superuser:
context["organizations"] = Organization.objects.all()
else:
context["organizations"] = self.request.profile.organizations.all()
context["page_type"] = "list"
context.update(self.get_sort_context())