Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django: How to make django comments not public by default

Using django comments framework http://docs.djangoproject.com/en/dev/ref/contrib/comments/

Not sure is there option, to make all comments non private before they passed moderation... Looks like all my comments are added to site, just after being posted. really need to change this

like image 671
Oleg Tarasenko Avatar asked Jan 22 '23 08:01

Oleg Tarasenko


1 Answers

One way to do this would be to write your own comments form which inherits from the django.contrib.comments.forms.CommentForm and rewrite its get_comment_create_data function. WARNING: This code is not tested.

from django.contrib.comments.forms import CommentForm

class MyCommentForm(CommentForm):
    def get_comment_create_data(self):
        data = super(MyCommentForm, self).get_comment_create_data()
        data['is_public'] = False
        return data

You would then hook this form into the comments systems as described in this section http://docs.djangoproject.com/en/dev/ref/contrib/comments/custom/

like image 146
Mark Lavin Avatar answered Feb 05 '23 02:02

Mark Lavin