增加几个 model

This commit is contained in:
virusdefender 2015-07-18 17:17:33 +08:00
parent 3ee4b57802
commit c6d6b13072
3 changed files with 12 additions and 2 deletions

View File

@ -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'

View File

@ -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):

View File

@ -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)
# 时间限制 单位是毫秒