Class NickName(models.Model):
name = models.CharField()
def __unicode__(self):
return unicode(self.name)
Class Bob(models.Model):
bob_nickname = models.ManyToManyField(NickName)
def __unicode__(self):
return unicode(self.bob_nickname)
Number1. How would I get the __unicode__
for class Bob to display the actual FK name, rather than the <django.db.models.fields.related.ManyRelatedFieldsManager Object at 0Xdsfjk>
?
EDIT: simply doing self.bob_nickname.all() seems to work fine. It aint pretty, but it displays the info: [<NickName: Ron>,<NickName: Randy>]
Number2. Also, how can I get the def __unicode__
to not escape \n
? I'd like to create a multiline unicode string
Thank you!