Example #1
0
user = User()
user.username = '******'
user.set_password("123456")
user.email="*****@*****.**"
user.is_staff = True
user.save()


# 插入一个比赛
C = Contest()
C.description = '写脚本真累'
C.participant = 200
C.source = 'zwlin'
C.title = 'Testing_Contest'
C.create_user = User.objects.get(username='******')
C.save()

with open("./item.json", 'r') as f:
    problems = json.load(f)
    id = 1000
    for item in problems:
        p = Problem()
        p.problem_id = str(id)
        p.title = item.get('Title', '')
        p.description = item.get('ProblemDescription', '')
        p.input_description = item.get('Input', '')
        p.output_description = item.get('Output', '')
        p.sample_input = item.get('SampleInput', '')
        p.sample_output = item.get('SampleOutput', '')
        p.hint = item.get('Hint', '')