From 4c6a4c46b340f5488d9f4f07ee1819f9615abf48 Mon Sep 17 00:00:00 2001 From: Wojciech Dubiel Date: Fri, 1 Mar 2019 22:09:32 +0100 Subject: [PATCH] (no-ticket) Allow superusers bypass ONLY_DEFAULT_CONTEST Change-Id: I43c968a759ffa838f5d307a32036fb7d88d6c1fc --- oioioi/contestexcl/middleware.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/oioioi/contestexcl/middleware.py b/oioioi/contestexcl/middleware.py index 9ea9079cb..48242ad79 100644 --- a/oioioi/contestexcl/middleware.py +++ b/oioioi/contestexcl/middleware.py @@ -61,7 +61,8 @@ def _default_selector(user, contest): user, contest ) and selector(user, contest) - if settings.ONLY_DEFAULT_CONTEST: + if settings.ONLY_DEFAULT_CONTEST and \ + (request.user is None or not request.user.is_superuser): qs = [Contest.objects.get(id=settings.DEFAULT_CONTEST)] else: qs = ExclusivenessConfig.objects.get_active(