mirror of
https://github.com/Without-Proper-Instructions/GoatCTF
synced 2025-10-08 07:40:46 +00:00
Add string representations for the models
This commit is contained in:
parent
536e21bf65
commit
2f09c7a6b2
@ -30,12 +30,19 @@ class Challenge(models.Model):
|
||||
self.description_html = markdown.markdown(self.description_markdown)
|
||||
super(Challenge, self).save(*args, **kwargs)
|
||||
|
||||
def __str__(self):
|
||||
return "{} {}: {}".format(
|
||||
self.get_category_display(), self.points, self.name)
|
||||
|
||||
|
||||
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")
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class Player(User):
|
||||
"""A player is a user with a team."""
|
||||
@ -47,3 +54,6 @@ class Solution(models.Model):
|
||||
challenge = models.ForeignKey("Challenge")
|
||||
solved_at = models.DateTimeField(auto_now_add=True)
|
||||
solver = models.ForeignKey("Player")
|
||||
|
||||
def __str__(self):
|
||||
return "{} by {}".format(self.challenge, self.solver)
|
||||
|
Loading…
x
Reference in New Issue
Block a user