No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

models.py 967B

123456789101112131415161718192021222324252627282930
  1. from django.contrib.auth.models import User
  2. from django.db import models
  3. from core.settings import TEAM_NAME_LENGTH, FLAG_LENGTH
  4. class Challenge(models.Model):
  5. """A challenge represents an individual problem to be solved."""
  6. points = models.IntegerField()
  7. category = models.CharField(max_length=2)
  8. flag = models.CharField(max_length=FLAG_LENGTH)
  9. description_markdown = models.TextField()
  10. description_html = models.TextField()
  11. class Team(models.Model):
  12. """A team is a collection of players."""
  13. name = models.CharField(max_length=TEAM_NAME_LENGTH)
  14. creator = models.ForeignKey("Player", related_name="created_teams")
  15. class Player(User):
  16. """A player is a user with a team."""
  17. team = models.ForeignKey("Team")
  18. class Solution(models.Model):
  19. """A solution is a player's """
  20. challenge = models.ForeignKey("Challenge")
  21. solved_at = models.DateTimeField(auto_now_add=True)
  22. solver = models.ForeignKey("Player")