Example #1
0
    Context:
        comment
            the `comments.comment` object for approval
    """
    comment = get_object_or_404(comments.get_model(), pk=comment_id, site__pk=settings.SITE_ID)

    # Flag the comment as approved.
    perform_approve(request, comment)
    
    return approve_done(request, next, comment)

# Confirmation views.

flag_done = msg_confirmation_view(
    message = _("Thanks for taking the time to improve the quality of discussion on our site"),
    message_func = messages.success,
    doc = 'Displays a "comment was flagged" message.'
)

delete_done = msg_confirmation_view(
    message = _("Thanks for removing"),
    message_func = messages.success,
    doc = 'Displays a "comment was deleted" message.'
)

approve_done = msg_confirmation_view(
    message = _("Thanks for approving"),
    message_func = messages.success,
    doc = 'Displays a "comment was approved" message.'
)
Example #2
0
        )

# The following functions actually perform the various flag/aprove/delete
# actions. They've been broken out into seperate functions to that they
# may be called from admin actions.

def perform_edit(request, comment):
    """
    Actually perform the flagging of a comment from a request.
    """
    # Save the comment and signal that it was saved
    comment.save()
    signals.comment_was_edited.send(
        sender  = comment.__class__,
        comment = comment,
        request = request,
    )

# Confirmation views.

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

edit_done = msg_confirmation_view(
    message = _("The %(name)s \"%(obj)s\" was changed successfully."),
    message_func = messages.success,
    doc = 'Displays a "comment was edited" success page.'
)