Skip to content

Commit

Permalink
Switch __str__ to __unicode__
Browse files Browse the repository at this point in the history
Let's be consistent in which method models use to identify themselves.
  • Loading branch information
akumria committed Feb 28, 2012
1 parent 6b43209 commit 17cb064
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions instagram/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ def object_from_dictionary(cls, entry):
entry_str_dict = dict([(str(key), value) for key,value in entry.items()])
return cls(**entry_str_dict)

def __repr__(self):
return unicode(self).encode('utf8')

class Image(ApiModel):

def __init__(self, url, width, height):
Expand Down Expand Up @@ -80,8 +83,8 @@ def __init__(self, name, **kwargs):
for key,value in kwargs.iteritems():
setattr(self, key, value)

def __str__(self):
return "Tag %s" % self.name
def __unicode__(self):
return "Tag: %s" % self.name

class Comment(ApiModel):
def __init__(self, *args, **kwargs):
Expand Down Expand Up @@ -137,8 +140,8 @@ def __init__(self, id, *args, **kwargs):
for key,value in kwargs.iteritems():
setattr(self, key, value)

def __str__(self):
return "User %s" % self.username
def __unicode__(self):
return "User: %s" % self.username

class Relationship(ApiModel):

Expand Down

0 comments on commit 17cb064

Please sign in to comment.