Beispiel #1
0
        user    = request.user,
        flag    = django_comments.models.CommentFlag.MODERATOR_APPROVAL,
    )

    comment.is_removed = False
    comment.is_public = True
    comment.save()

    signals.comment_was_flagged.send(
        sender  = comment.__class__,
        comment = comment,
        flag    = flag,
        created = created,
        request = request,
    )

# Confirmation views.

flag_done = confirmation_view(
    template = "comments/flagged.html",
    doc = 'Displays a "comment was flagged" success page.'
)
delete_done = confirmation_view(
    template = "comments/deleted.html",
    doc = 'Displays a "comment was deleted" success page.'
)
approve_done = confirmation_view(
    template = "comments/approved.html",
    doc = 'Displays a "comment was approved" success page.'
)
Beispiel #2
0
        ]
        return render_to_response(
            template_list,
            {"comment": form.data.get("comment", ""), "form": form, "next": data.get("next", next)},
            RequestContext(request, {}),
        )

    # Otherwise create the comment
    comment = form.get_comment_object()
    comment.ip_address = request.META.get("REMOTE_ADDR", None)
    if request.user.is_authenticated():
        comment.user = request.user

    # Signal that the comment is about to be saved
    responses = signals.comment_will_be_posted.send(sender=comment.__class__, comment=comment, request=request)

    for (receiver, response) in responses:
        if response == False:
            return CommentPostBadRequest("comment_will_be_posted receiver %r killed the comment" % receiver.__name__)

    # Save the comment and signal that it was saved
    comment.save()
    signals.comment_was_posted.send(sender=comment.__class__, comment=comment, request=request)

    return next_redirect(request, fallback=next or "comments-comment-done", c=comment._get_pk_val())


comment_done = confirmation_view(
    template="comments/posted.html", doc="""Display a "comment was posted" success page."""
)