Hi. Still learning, slowly. This is Django 1.0.2 The relevant models are Unit, Connector and Cable
class Cable(models.Model): cable = models.CharField(max_length=8, blank=False) desc = models.CharField(max_length=128, blank=True) cabletype = models.ForeignKey(Cabletype, blank=True, null=True) connector_left = models.ForeignKey(Connector, related_name='cable_left', blank=True, null=True) connector_right = models.ForeignKey(Connector, related_name='cable_right', blank=True, null=True) length = models.DecimalField (max_digits=8,decimal_places=2,blank=True,null=True) version = models.ForeignKey(Version, blank=True, null=True) def __unicode__(self): return '%s:%s' % (self.cable, self.version) class Meta: ordering = ['cable'] unique_together=('cable','version') class Unit(models.Model): unit = models.CharField(max_length=8, blank=False) desc = models.CharField(max_length=128, blank=True) rack = models.ForeignKey(Rack) version = models.ForeignKey(Version, blank=True, null=True) def __unicode__(self): return '%s-%s' % (unicode(self.rack), self.unit) class Meta: ordering = ['rack','unit'] unique_together=('rack','unit') class Connector(models.Model): connector = models.CharField(max_length=8, blank=False) desc = models.CharField(max_length=128, blank=True) unit = models.ForeignKey(Unit) connectortype = models.ForeignKey(Connectortype, blank=True, null=True) def __unicode__(self): return '%s-%s' % (unicode(self.unit), self.connector) class Meta: ordering = ['unit','connector'] unique_together=('unit','connector') Attempting my first reportlab report I get this TypeError: coercing to Unicode: need string or buffer, Connector found at the last line in the following view (very much a prototype) <snip> cables = Cable.objects.all() for cable in cables: print "cable=", cable # prints OK print "connector_left=", cable.connector_left #prints OK p = Paragraph(cable.cable+cable.desc+cable.connector_left, style) If I make the last line: p = Paragrapg(cable.cable+cable.desc,style) the report is generated correctly. What does the TypeError want me to change? Thanks Mike --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---