From 70f08422e643bb859dcad7f21a1d340200beca51 Mon Sep 17 00:00:00 2001 From: Markus Krogh Date: Sat, 15 Jul 2017 15:24:13 +0200 Subject: 2+3 support __str__ --- maconomy/models.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/maconomy/models.py b/maconomy/models.py index 820014d..75c039f 100644 --- a/maconomy/models.py +++ b/maconomy/models.py @@ -9,14 +9,17 @@ class Employee: def from_result(cls, result): id, name, email = result[:3] return cls(id, name, email) - + def __unicode__(self): if type(self.name) is not unicode: - name = unicode(self.name,"ISO-8859-1") + name = unicode(self.name, "ISO-8859-1") else: name = self.name return u"{} ({})".format(name, self.id) + def __str__(self): + return "{} ({})".format(self.name, self.id) + class Timesheet: def __init__(self, week, submitted, approved, employee, approver): -- cgit v1.1