[#10] [#12] Add Team and Player model

This commit is contained in:
Ian Adam Naval 2014-10-31 19:25:21 -04:00
parent 0549394bf5
commit 16cb4ab2ca
3 changed files with 16 additions and 2 deletions

View File

@ -1,5 +1,6 @@
from django.contrib.auth.models import User
from django.db import models
from core.settings import FLAG_LENGTH
from core.settings import TEAM_NAME_LENGTH, FLAG_LENGTH
class Challenge(models.Model):
@ -9,3 +10,14 @@ class Challenge(models.Model):
flag = models.CharField(max_length=FLAG_LENGTH)
description_markdown = models.TextField()
description_html = models.TextField()
class Team(models.Model):
"""A team is a collection of players."""
name = models.CharField(max_length=TEAM_NAME_LENGTH)
creator = models.ForeignKey("Player", related_name="created_teams")
class Player(User):
"""A player is a user with a team."""
team = models.ForeignKey("Team")

View File

@ -1 +1,2 @@
FLAG_LENGTH = 256
TEAM_NAME_LENGTH = 64

View File

@ -1 +1,2 @@
Django==1.7.1
django-gravatar2==1.1.4