def moderate_view(self, request, object_id, extra_context=None):
        """
        Handles moderate object tool through a somewhat hacky changelist view
        whose queryset is altered via CommentAdmin.get_changelist to only list
        comments for the object under review.
        """
        opts = self.model._meta
        app_label = opts.app_label

        view = CommentAdmin(model=Comment, admin_site=self.admin_site)

        view.list_filter = ()
        view.list_display = (
            'comment_text',
            'moderator_reply',
            '_user',
            'submit_date',
        )

        model = self.model
        obj = get_object_or_404(model, pk=unquote(object_id))
        request.obj = obj
        view.change_list_template = self.change_list_template or [
            'admin/%s/%s/moderate.html' % (app_label, opts.object_name.lower()),
            'admin/%s/moderate.html' % app_label,
            'admin/moderate.html'
        ]
        orig_has_change_permission = self.has_change_permission(request, obj)
        if not orig_has_change_permission:
            raise PermissionDenied
        extra_context = {
            'opts': opts,
            'original': obj,
            'orig_has_change_permission': orig_has_change_permission,
        }
        return view.changelist_view(request, extra_context)
def moderate_view ( self , request , object_id , extra_context = None ) : opts = self . model . _meta app_label = opts . app_label view = CommentAdmin ( model = Comment , admin_site = self . admin_site ) view . list_filter = ( ) view . list_display = ( 'comment_text' , 'moderator_reply' , '_user' , 'submit_date' , ) model = self . model obj = get_object_or_404 ( model , pk = unquote ( object_id ) ) request . obj = obj view . change_list_template = self . change_list_template or [ 'admin/%s/%s/moderate.html' % ( app_label , opts . object_name . lower ( ) ) , 'admin/%s/moderate.html' % app_label , 'admin/moderate.html' ] orig_has_change_permission = self . has_change_permission ( request , obj ) if not orig_has_change_permission : raise PermissionDenied extra_context = { 'opts' : opts , 'original' : obj , 'orig_has_change_permission' : orig_has_change_permission , } return view . changelist_view ( request , extra_context )
Handles moderate object tool through a somewhat hacky changelist view
        whose queryset is altered via CommentAdmin.get_changelist to only list
        comments for the object under review.