From c6d6b1307264f97278e887ad04d72cfee941074c Mon Sep 17 00:00:00 2001 From: virusdefender <1670873886@qq.com> Date: Sat, 18 Jul 2015 17:17:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=87=A0=E4=B8=AA=20model?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- account/models.py | 3 +++ contest/models.py | 9 ++++++++- problem/models.py | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/account/models.py b/account/models.py index cb4ec922..1b8636ae 100644 --- a/account/models.py +++ b/account/models.py @@ -15,7 +15,10 @@ class UserManager(models.Manager): class User(AbstractBaseUser): + # 用户名 username = models.CharField(max_length=30, unique=True) + # 真实姓名 + real_name = models.CharField(max_length=30, blank=True, null=True) admin_group = models.ForeignKey(AdminGroup, null=True, on_delete=models.SET_NULL) USERNAME_FIELD = 'username' diff --git a/contest/models.py b/contest/models.py index aeb98005..1514b791 100644 --- a/contest/models.py +++ b/contest/models.py @@ -1,11 +1,18 @@ # coding=utf-8 from django.db import models +from account.models import User from problem.models import AbstractProblem class Contest(models.Model): - pass + title = models.CharField(max_length=40) + description = models.TextField() + is_public = models.BooleanField() + password = models.CharField(max_length=30, blank=True, null=True) + start_time = models.DateTimeField() + end_time = models.DateTimeField() + created_by = models.ForeignKey(User) class ContestProblem(AbstractProblem): diff --git a/problem/models.py b/problem/models.py index 53f654e3..844f4db7 100644 --- a/problem/models.py +++ b/problem/models.py @@ -26,7 +26,7 @@ class AbstractProblem(models.Model): # 最后更新时间 last_update_time = models.DateTimeField(auto_now=True) # 这个题是谁创建的 - author = models.ForeignKey(User) + created_by = models.ForeignKey(User) # 来源 source = models.CharField(max_length=30, blank=True) # 时间限制 单位是毫秒