rentals: Add __str__()
for LockerUnit
This commit is contained in:
parent
b956812e67
commit
d41dc9044c
@ -35,6 +35,11 @@ class LockerUnit(models.Model):
|
|||||||
]
|
]
|
||||||
ordering = ["index"]
|
ordering = ["index"]
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
last_letter = chr(ord(self.first_letter) + self.columns - 1)
|
||||||
|
last_number = self.first_number + self.columns * self.rows
|
||||||
|
return f"{self.bank.name} (Unit {self.first_letter}{self.first_number}-{last_letter}{last_number})"
|
||||||
|
|
||||||
def letter_for_column(self, column: int) -> str:
|
def letter_for_column(self, column: int) -> str:
|
||||||
return chr(column + ord(self.first_letter))
|
return chr(column + ord(self.first_letter))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user