Skip to content

Commit

Permalink
Add due date to items mail_repr
Browse files Browse the repository at this point in the history
  • Loading branch information
sondregronas committed Aug 24, 2023
1 parent 8cab546 commit 4ab9246
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions BookingSystem/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,19 @@ def api_repr(self) -> dict:
}

def mail_repr(self) -> str:
return f'<strong>{self.lender_name}: {self.id}</strong> <small>{self.name} ({self.category})</small>'
return f'<strong>{self.lender_name}: {self.id}</strong> <small>{self.name} ({self.category}, Frist: {self.order_due_date_fmt})</small>'

def __str__(self) -> str:
if self.order_due_date:
return f'{self.lender_name}: {self.id} - {self.name} ({self.category}, {parser.parse(self.order_due_date):%d.%m.%Y})'
return f'{self.lender_name}: {self.id} - {self.name} ({self.category}, {self.order_due_date_fmt})'
return f'{self.id} - {self.name} - {self.category}'

@property
def order_due_date_fmt(self) -> str:
if not self.order_due_date:
return ''
return parser.parse(self.order_due_date).strftime('%d.%m.%Y')

@property
def user(self) -> dict:
if self.borrowed_to is None:
Expand Down

0 comments on commit 4ab9246

Please sign in to comment.