Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Provide more useful str representations for models" #211

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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