On 2012-03-25, at 06:27 , spike wrote: > Thanks for the reply. > > Why am I only returning one or two fields from each model? If I define 5 > fields, shouldn't I return all 5?
There is no "should" when it comes to __unicode__, you can return whatever you want. But the *purpose* of unicode is to return a human-readable default identification/representation of the object, not to encode the object's state. For instance let's say you're creating a mass transit site with bus lines. A bus line may have dozens of attributes with various information such as the line's endpoints or the line's supervisor or whatever. But you don't want to display those every time you refer to the bus line. Instead, you probably just want "Line <number of the line>". That's what you set up in __unicode__, a single field: def __unicode__(self): return u"Line %s" % self.line_number Side-note: neither `return` nor `__unicode__` are features of Django, you may want to read through the Python tutorial at least. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.