Skip to content

Commit

Permalink
Merge pull request #211 from 2i2c-org/revert-205-str
Browse files Browse the repository at this point in the history
Revert "Provide more useful str representations for models"
  • Loading branch information
yuvipanda authored Nov 26, 2024
2 parents 287b529 + 9bbccee commit e54ccc8
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions frx_challenges/web/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ class Submission(models.Model):
created_at = models.DateTimeField(auto_now_add=True)
last_updated = models.DateTimeField(auto_now=True)

def __str__(self):
return f"name:{self.name} user:{self.user.username}"

@property
def best_version(self) -> Version:
"""
Expand Down Expand Up @@ -111,7 +108,7 @@ def latest_evaluation(self) -> Evaluation | None:
return None

def __str__(self):
return f"file:{self.filename} submission:{self.submission.name} user:{self.user.username}"
return f"({self.status}) {self.data_uri}"


class Evaluation(models.Model):
Expand Down Expand Up @@ -148,7 +145,7 @@ def ordered_results(self) -> list:
return results_list

def __str__(self):
return f"submission:{self.version.submission.name} version:{self.version.id} id:{self.id} status:{self.status}"
return f"({self.status}) {self.result} {self.version.data_uri}"


class Collaborator(models.Model):
Expand All @@ -160,9 +157,6 @@ class Collaborator(models.Model):
submission = models.ForeignKey(Submission, on_delete=models.CASCADE)
user = models.ForeignKey(User, on_delete=models.CASCADE)

def __str__(self):
return f"submission:{self.submission.name} user:{self.user.username}"

class Meta:
# A user can be added as a collaborator only once
unique_together = ("user", "submission")
Expand Down

0 comments on commit e54ccc8

Please sign in to comment.