title: Django retrieve all comments for a user
body: <p>I'm using django-profiles and django.contrib.comments and I am trying to display all comments for a particular user in their profile.</p>
  
  <p>This is using the default profile_detail view from django-profiles.</p>
  
  <p>I've tried these two approaches and neither is returning any objects (although objects matching this query do exist):</p>
  
  <pre><code>{% for comment in profile.user.comment_set.all %}
  </code></pre>
  
  <p>and </p>
  
  <pre><code>{% for comment in profile.user.user_comments.all %}
  </code></pre>
  
  <p>In the source code for django.contrib.comments, the foreign key to user in the Comment model has the following related name:</p>
  
  <pre><code>user = models.ForeignKey(User, verbose_name=_('user'),
                      blank=True, null=True, related_name="%(class)s_comments")
  </code></pre>
  
  <p>Comments also has a custom manager:</p>
  
  <pre><code># Manager
      objects = CommentManager()
  </code></pre>
  
  <p>Which is defined as:</p>
  
  <pre><code>class CommentManager(models.Manager):
  
      def in_moderation(self):
          """
          QuerySet for all comments currently in the moderation queue.
              """
          return self.get_query_set().filter(is_public=False, is_removed=False)
  
      def for_model(self, model):
          """
          QuerySet for all comments for a particular model (either an instance or
          a class).
          """
          ct = ContentType.objects.get_for_model(model)
          qs = self.get_query_set().filter(content_type=ct)
          if isinstance(model, models.Model):
              qs = qs.filter(object_pk=force_unicode(model._get_pk_val()))
          return qs
  </code></pre>
  
  <p>Is the custom manager causing the .all query not to return anything? Am I accessing the reverse relation correctly? Any help would be appreciated.</p>