Optional Unicode Return Values

The __unicode__() method of a model can return optional values. For instance, if the values need to be returned from other models.

def __unicode__(self):
    return (u'%s%s%s') % (self.target, ('|' if self.page_type else ''), (self.page_type if self.page_type else ''))


def __unicode__(self):
    ";".join([unicode(x) for x in (thing_a, thing_b, getattr(obj, "optional_attribute", None), ...etc...) if x is not None])
Edit tutorial

Comment on This Data Unit