I have 03 models book->target_readers and book has collection.
class Book(models.Model):
def __unicode__(self):
return "%s (%s)" % (self.title, self.reference)
reference = models.CharField(max_length=100)
title = models.CharField(max_length=200)
collection = models.ForeignKey(Collection)
class Collection(models.Model):
def __unicode__(self):
return self.name
)
name = models.CharField(max_length=200)
target_readers = models.ManyToManyField(Target_Readers, blank=True, null=True)
class Target_Readers(models.Model):
def __unicode__(self):
return self.name
name = models.CharField(max_length=200, verbose_name="target reader")
In my template i do like this to get the target_readers of the book
{% for book in books %}
{{ book.title }}
{{ book.public_price }}
{{ book.collection.target_readers.name }}
But I don't get the any results for target reader.
Anyone know how can I do this?