Hello,
I have a model like this:

class Forum(models.Model):
question = models.CharField(max_length=150)
body = models.TextField()
pub_date = models.DateTimeField(default=datetime.now)
image = models.ImageField(upload_to=get_upload_file_name)
creator = models.ForeignKey(User, related_name="creator_set")
likes = models.ManyToManyField(User, through="Like")

def __unicode__(self):
return self.question

class Like(models.Model):
forum = models.ForeignKey(Forum)
liked = models.ForeignKey(User)
liked_date = models.DateTimeField(default=datetime.now)

def __unicode__(self):
return "%s likes %s" % (self.liked, self.forum)

Now doing this gets me the list of users liked the forum:

>>>forums = Forum.objects.all()
>>>forums
>>>[<User: Nancy>, <User: tikli>]

But how do i get the username, or the users to use in the template. I get
all the list, like:

[<User: Nancy>, <User: tikli>]
[<User: Nancy>, <User: tikli>]

Please help.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to