title: How can I traverse a reverse generic relation in a Django template?
body: <p>I have the following class that I am using to bookmark items:</p>
  
  <pre><code>class BookmarkedItem(models.Model):
       is_bookmarked = models.BooleanField(default=False)
       user = models.ForeignKey(User)
       content_type = models.ForeignKey(ContentType)
       object_id = models.PositiveIntegerField()
       content_object = generic.GenericForeignKey()
  </code></pre>
  
  <p>And I am defining a reverse generic relationship as follows:</p>
  
  <pre><code>class Link(models.Model):
      url = models.URLField()
      bookmarks = generic.GenericRelation(BookmarkedItem)
  </code></pre>
  
  <p>In one of my views I generate a queryset of all links and add this to a context:</p>
  
  <pre><code>links = Link.objects.all()
  context = {
       'links': links
  }
  return render_to_response('links.html', context)
  </code></pre>
  
  <p>The problem I am having is how to traverse the generic relationship in my template. For each link I want to be able to check the is_bookmarked attribute and change the add/remove bookmark button according to whether the user already has it bookmarked or not. Is this possible to do in the template? Or do I have to do some additional filtering in the view and pass another queryset?</p>