use python repr/str for models
This commit is contained in:
parent
f03c371255
commit
cd6169d0b3
2 changed files with 10 additions and 1 deletions
|
@ -6,5 +6,8 @@ class Agent(models.Model):
|
|||
name = models.CharField(max_length=255)
|
||||
user = models.OneToOneField(User, on_delete=models.CASCADE, null=True)
|
||||
|
||||
def __str__(self):
|
||||
def __repr__(self):
|
||||
return f"Agent_{self.name}"
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
|
|
@ -14,6 +14,9 @@ class BudgetLine(models.Model):
|
|||
title = models.CharField(max_length=255)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.title}"
|
||||
|
||||
def __repr__(self):
|
||||
return f"BudgetLine_{self.title}_{self.amount}€"
|
||||
|
||||
|
||||
|
@ -25,4 +28,7 @@ class BudgetGroup(models.Model):
|
|||
return sum(i.amount for i in self.budgetline_set.all())
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.name}"
|
||||
|
||||
def __repr__(self):
|
||||
return f"BudgetGroup_{self.name}"
|
||||
|
|
Loading…
Reference in a new issue