def lend(self, borrowerID, date = None): import datetime borrower = UserAccount.getuser(borrowerID) owner = UserAccount.get_by_id(self.owner.id()) self.borrower = borrower.key if(date): self.due_date = datetime.datetime.strptime(date, '%Y-%m-%d'); else: self.due_date = datetime.datetime.now() + datetime.timedelta(days=int(owner.lending_length))
def get_borrower(self): borrower = UserAccount.get_by_id(self.borrower.id()) return borrower.name
def get_owner(self): owner = UserAccount.get_by_id(self.owner.id()) return owner.name