Skip to content

Commit

Permalink
Merge pull request #76 from jamiecjx/main
Browse files Browse the repository at this point in the history
Django admin displays additional data
  • Loading branch information
TheOriginalSoni authored Nov 12, 2024
2 parents 26793bc + 2dc9f16 commit 3eada08
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions myus/myus/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ class LeaderboardStyle(models.TextChoices):
def public_puzzles(self):
return self.puzzles.filter(progress_threshold__lte=self.progress_floor)

def __str__(self):
return self.name


class Puzzle(models.Model):
hunt = models.ForeignKey(Hunt, on_delete=models.CASCADE, related_name="puzzles")
Expand Down Expand Up @@ -113,6 +116,9 @@ def is_viewable_by(self, team):

return progress >= self.progress_threshold

def __str__(self):
return self.hunt.name + "_" + self.slug


class GuessResponse(models.Model):
"""Any special response to a particular answer guess.
Expand All @@ -133,6 +139,9 @@ class GuessResponse(models.Model):
class Meta:
unique_together = ("puzzle", "guess")

def __str__(self):
return self.puzzle.name + "_" + self.guess


class Team(models.Model):
# TODO: Should we have a team captain?
Expand Down Expand Up @@ -182,6 +191,9 @@ class Meta:
),
]

def __str__(self):
return self.hunt.name + "_" + self.name


class Guess(models.Model):
guess = models.CharField(max_length=500)
Expand All @@ -204,6 +216,9 @@ class Meta:
)
]

def __str__(self):
return self.team.name + "_" + self.puzzle.name + "_" + self.guess


class ExtraGuessGrant(models.Model):
"Extra guesses granted to a particular team."
Expand All @@ -220,3 +235,6 @@ class Meta:
name="unique_team_puzzle_grant", fields=["team", "puzzle"]
),
]

def __str__(self):
return self.team.name + "_" + self.puzzle.name

0 comments on commit 3eada08

Please sign in to comment.