diff --git a/account/models.py b/account/models.py index cb4ec92..1b8636a 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 aeb9800..1514b79 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 53f654e..844f4db 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) # 时间限制 单位是毫秒