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

fix(api): improving the serialisation of some of the models, to make debugging easier #260

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion api/account/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def __repr__(self):
return f"<Community {self.name}>"

def __str__(self):
return f"Community - {self.name}"
return f"Community - #{self.id} - {self.name}"

def get_scorer(self) -> Scorer:
if self.scorer.type == Scorer.Type.WEIGHTED:
Expand Down
7 changes: 5 additions & 2 deletions api/registry/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Meta:
unique_together = ["address", "community"]

def __str__(self):
return f"{self.address}"
return f"Passport #{self.id} for address {self.address} in community [{self.community}]"


class Stamp(models.Model):
Expand All @@ -26,7 +26,7 @@ class Stamp(models.Model):
credential = models.JSONField(default=dict)

def __str__(self):
return f"#{self.hash}"
return f"Stamp #{self.id} for passport [{self.passport}] hash #{self.hash} provider {self.provider}"

class Meta:
unique_together = ["hash", "passport"]
Expand Down Expand Up @@ -54,3 +54,6 @@ class Status:
)
error = models.TextField(null=True, blank=True)
evidence = models.JSONField(null=True, blank=True)

def __str__(self):
return f"Score #{self.id} for passport [{self.passport}]: score={self.score}, status={self.status}, last_score_timestamp={self.last_score_timestamp}, error={self.error}, evidence={self.evidence}"