后端修改比赛创建部分,同时在models中增加了几个字段

This commit is contained in:
hohoTT
2015-08-18 20:12:27 +08:00
parent 15febd5cc7
commit bdf3fa9ed9
3 changed files with 57 additions and 5 deletions

View File

@@ -3,18 +3,25 @@ from django.db import models
from account.models import User
from problem.models import AbstractProblem
from group.models import Group
class Contest(models.Model):
title = models.CharField(max_length=40)
description = models.TextField()
# 比赛模式 现在有 acm 模式,按照 ac 题目数量得分模式
# 按照 ac 的题目的总分得分模式和按照通过的测试用例总分得分模式等
# 比赛模式0 即为是acm模式1 即为是按照总的 ac 题目数量排名模式2 即为按照 ac 的题目的总分排名模式
mode = models.IntegerField()
# 是否显示排名结果
show_rank = models.BooleanField()
# 如果这一项不为空,那这就不是公开赛,需要密码才能进入
# 是否显示别人的提交记录
show_user_submission = models.BooleanField()
# 只能超级管理员创建公开赛,管理员只能创建小组内部的比赛
# 如果这一项不为空,即为有密码的公开赛,没有密码的可以为小组赛或者是公开赛(此时用比赛的类型来表示)
password = models.CharField(max_length=30, blank=True, null=True)
# 比赛的类型: 0 即为是小组赛1 即为是无密码的公开赛2 即为是有密码的公开赛
contest_type = models.IntegerField()
# 开始时间
start_time = models.DateTimeField()
# 结束时间
@@ -23,7 +30,10 @@ class Contest(models.Model):
create_time = models.DateTimeField(auto_now_add=True)
# 最后修改时间
last_updated_time = models.DateTimeField(auto_now=True)
# 这个比赛是谁创建的
created_by = models.ForeignKey(User)
groups = models.ManyToManyField(Group)
class Meta:
db_table = "contest"