(request, uid)
return render(request, "forms/form_moderate.html", context)
Used to make display post moderate form given a post request.
Used to make display post moderate form given a post request.
Used to make display post moderate form given a post request .
def post_moderate(request, uid):
    """Used to make display post moderate form given a post request."""

    user = request.user
    post = Post.objects.filter(uid=uid).first()

    if request.method == "POST":
        form = PostModForm(post=post, data=request.POST, user=user, request=request)
        if form.is_valid():
            action = form.cleaned_data.get('action')
            url = moderate(request=request, post=post, action=action)
            return redirect(url)
        else:
            errors = ','.join([err for err in form.non_field_errors()])
            messages.error(request, errors)
            return redirect(reverse("post_view", kwargs=dict(uid=post.root.uid)))
    else:
        form = PostModForm(post=post, user=user, request=request)

    context = dict(form=form, post=post, user=user, ALLOW_POST_CLOSING=settings.ALLOW_POST_CLOSING)
    return render(request, "forms/form_moderate.html", context)
def post_moderate ( request , uid ) : user = request . user post = Post . objects . filter ( uid = uid ) . first ( ) if request . method == "POST" : form = PostModForm ( post = post , data = request . POST , user = user , request = request ) if form . is_valid ( ) : action = form . cleaned_data . get ( 'action' ) url = moderate ( request = request , post = post , action = action ) return redirect ( url ) else : errors = ',' . join ( [ err for err in form . non_field_errors ( ) ] ) messages . error ( request , errors ) return redirect ( reverse ( "post_view" , kwargs = dict ( uid = post . root . uid ) ) ) else : form = PostModForm ( post = post , user = user , request = request ) context = dict ( form = form , post = post , user = user , ALLOW_POST_CLOSING = settings . ALLOW_POST_CLOSING ) return render ( request , "forms/form_moderate.html" , context )