Django comments reverse relationship

django, django-comments

Solution

Yes, you should be able to do:

from django.contrib.contenttypes import generic
class Post(models.Model):
    ...
    comments = generic.GenericRelation(Comments)

per the Django docs on reverse generic relations

Problem

When using django.contrib.comments is there anyway to add the reverse relationship to a model that has comments? For example: ``` post = Post.objects.all()[0] comments = post.comments.all() ```

Original source