문제

I'm looking at implementing django-threadedcomments and am wondering if it is able to restrict threading to replies made by a moderator/owner, similar to how Yelp handles user reviews and business owner replies.

For example the comments would look like:

"Comment 1" by User1
"Comment 2" by User2
          "Reply 1" by Owner
"Comment 3" by User3
          "Reply 2" by Owner
"Comment 4" by User4
"Comment 5" by User5

How would you do this in django-threadedcomments? Alternatively if you've done this using the built-in comments framework I'm open to doing it that way as well.

도움이 되었습니까?

해결책 2

In case anyone else is looking for this, I was able to do this in django-threadedcomments by using the PARENT_ID in the

{% render_comment_form for [object] with [parent_id] %}

template tag.

다른 팁

I'm currently working on a small CMF based on Django and I've implemented threaded comments there which seems to work fine. You can grab the latest source at http://github.com/kovshenin/Juice The module you're interested in is juice.comments. The threading is illustrated in the news-single.html template which is called from the juice.front.views.single view. Note the level and indent parameters which are passed to the template:

# comments
p.comments = Comment.tree.filter(content_type__pk=ctype.id, object_id=p.id)

for c in p.comments:
    c.indent = c.level * 50

The p object is of type Post which is passed on to the template.

Now, regarding restricting threading to other people than the admin/owner. In that same view I illustrate how to process the commenting form, where you can clearly see that I'm looking for the parent comment if one is supplied. You'll have to add some logics there and check for current user login and his privileges, and if they're not set, use parent = NULL. In the template just hide the reply link ;)

Hope that helps, and beware that I'm constantly working on this project, 5-10 commits every day, so keep an eye on what source you download. The documentation currently contains only the way posts are handled (already partly outdated), but I'll be updating that constantly.

Cheers.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top