(request, uid)
Mark post as spam.
Mark post as spam.
Mark post as spam .
def mark_spam(request, uid):
    """
    Mark post as spam.
    """

    # Trigger post
    post = Post.objects.filter(uid=uid).first()

    # A restore parameter sent toggles spam off.
    state = False if request.GET.get("restore") else True

    # Apply the toggle.
    if post:
        moderate.toggle_spam(request, post)
    else:
        messages.error(request, "Post does not seem to exist")

    # Was spam actually
    if post.is_spam:
        return redirect(reverse('post_topic', kwargs=dict(topic='spam')))
    else:
        return redirect('/')
def mark_spam ( request , uid ) : # Trigger post post = Post . objects . filter ( uid = uid ) . first ( ) # A restore parameter sent toggles spam off. state = False if request . GET . get ( "restore" ) else True # Apply the toggle. if post : moderate . toggle_spam ( request , post ) else : messages . error ( request , "Post does not seem to exist" ) # Was spam actually if post . is_spam : return redirect ( reverse ( 'post_topic' , kwargs = dict ( topic = 'spam' ) ) ) else : return redirect ( '/' )