From 2026deafee0c29a024c7e4b8f657832c9b931a87 Mon Sep 17 00:00:00 2001 From: virusdefender <1670873886@qq.com> Date: Mon, 28 Mar 2016 15:56:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AF=94=E8=B5=9B=E6=B2=A1=E6=9C=89=E7=BB=93?= =?UTF-8?q?=E6=9D=9F=E7=9A=84=E6=97=B6=E5=80=99=E4=B8=8D=E8=83=BD=E5=85=AC?= =?UTF-8?q?=E5=BC=80=E9=A2=98=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contest/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contest/views.py b/contest/views.py index 8a80d7e..db144f4 100644 --- a/contest/views.py +++ b/contest/views.py @@ -283,11 +283,13 @@ class MakeContestProblemPublicAPIView(APIView): def post(self, request): problem_id = request.data.get("problem_id", -1) try: - problem = ContestProblem.objects.get(id=problem_id) + problem = ContestProblem.objects.get(id=problem_id, is_public=False) problem.is_public = True problem.save() except ContestProblem.DoesNotExist: return error_response(u"比赛不存在") + if problem.contest.status != CONTEST_ENDED: + return error_response(u"比赛还没有结束,不能公开题目") Problem.objects.create(title=problem.title, description=problem.description, input_description=problem.input_description, output_description=problem.output_description,