mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2024-09-21 16:33:22 +00:00
Accessories:添加功能从已有的比赛题目创建比赛!
This commit is contained in:
parent
937f77e4bc
commit
a6ee2b2172
@ -1,9 +1,27 @@
|
||||
import django
|
||||
from contest.models import Contest
|
||||
from contest.models import *
|
||||
|
||||
django.setup()
|
||||
|
||||
def add_exist_problem_to_contest(problems, contest_id):
|
||||
for problem in problems:
|
||||
print problem.title
|
||||
|
||||
def add_exist_problem_to_contest(problems, contest_id):
|
||||
try:
|
||||
contest = Contest.objects.get(pk=contest_id)
|
||||
except Contest.DoesNotExist:
|
||||
print "Contest Doesn't Exist!"
|
||||
return
|
||||
i = 1
|
||||
for problem in problems:
|
||||
print "Add the problem:"
|
||||
print problem.title
|
||||
ContestProblem.create(contest, sort_index=str(i),
|
||||
title=problem.title, description=problem.description,
|
||||
input_description=problem.input_description,
|
||||
output_description=problem.output_description,
|
||||
samples=problem.samples,
|
||||
test_case_id=problem.test_case_id,
|
||||
hint=problem.hint,
|
||||
created_by=problem.created_by,
|
||||
time_limit=problem.time_limit,
|
||||
memory_limit=problem.memory_limit)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user