Try either:
def __str__(self):
return '%s - %s' % (self.name, str(self.category))
or
def __str__(self):
return '%s - %s' % (self.name, self.category.name)
The problem is that it is using __repr__ to print it out, not str. To
force str you have to use the str(). Or you
I apologize in advance if this is a stupid question - I'm new to
Django, and a little over my head (but loving it!)
I'm trying to return a field from a foreign key relationship as part of
my __str__ method. When I do, I get this output in the admin interface:
Product Name -
What am I doing
2 matches
Mail list logo