Re: returning related field as part of __str__() method?

2006-08-22 Thread Chris Long
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

returning related field as part of __str__() method?

2006-08-22 Thread [EMAIL PROTECTED]
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