honzakral / django-threadedcomments

django-threadedcomments is a simple yet flexible threaded commenting system for Django.
BSD 3-Clause "New" or "Revised" License
622 stars 165 forks source link

Сomment field in modal #88

Open nurzhannogerbek opened 7 years ago

nurzhannogerbek commented 7 years ago

Thanks for this project!

I have question. I have model "Project". I use django-reversion app to controll model changes. I want field comments in my model cause I need to controll what kind of comments was in Project object. Right now commection with object and comment takes place in templates with the help of {% render_comment_form for object %}. How I can create such field in my model corrently?

models.py:

class Project(models.Model):
         comments = models.ManyToManyField(Comment, through='Comment', help_text=_('Comment'))
vdboor commented 6 years ago

Django comments use a generic foreign key, so creating a reverse relation is a bit difficult.

It can be done through, see https://github.com/django-fluent/django-fluent-comments/blob/master/fluent_comments/models.py#L94 for an example