4

使用 django 评论框架http://docs.djangoproject.com/en/dev/ref/contrib/comments/

不确定是否有选项,在通过审核之前将所有评论设为非私密...看起来我的所有评论都在发布后添加到网站。真的需要改变这个

4

2 回答 2

5

一种方法是编写您自己的评论表单,该表单继承自django.contrib.comments.forms.CommentForm并重写其get_comment_create_data功能。警告:此代码未经测试。

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

然后,您可以按照本节http://docs.djangoproject.com/en/dev/ref/contrib/comments/custom/中的说明将此表单连接到评论系统中

于 2010-04-02T14:33:39.293 回答
4

设置评论版主并将“auto_moderate_field”设置为模型上的 DateField 或 DateTimeField,并将“moderate_after”设置为 0。

class ArticleModerator(CommentModerator):
    email_notification = True
    enable_field = 'enable_comments'
    auto_moderate_field = 'pub_date'
    moderate_after = 0

moderator.register(Article, ArticleModerator)

文档中的更多信息: https ://docs.djangoproject.com/en/dev/ref/contrib/comments/moderation/#built-in-moderation-options

于 2011-10-28T22:52:38.037 回答