separate contest submission and regular submission

This commit is contained in:
zema1
2017-09-30 10:26:54 +08:00
parent 2a91fd5e9f
commit d650252a1a
9 changed files with 103 additions and 77 deletions

View File

@@ -2,7 +2,7 @@ from django.db import models
from django.utils.timezone import now
from jsonfield import JSONField
from account.models import User
from account.models import User, AdminType
from utils.models import RichTextField
@@ -56,6 +56,9 @@ class Contest(models.Model):
return ContestType.PASSWORD_PROTECTED_CONTEST
return ContestType.PUBLIC_CONTEST
def is_contest_admin(self, user):
return user.is_authenticated() and (self.created_by == user or user.admin_type == AdminType.SUPER_ADMIN)
class Meta:
db_table = "contest"
ordering = ("-create_time",)