(request, post=None)
return fields
Used to retrieve all fields in a request used for editing and creating posts.
Used to retrieve all fields in a request used for editing and creating posts.
Used to retrieve all fields in a request used for editing and creating posts .
def get_fields(request, post=None):
    """
    Used to retrieve all fields in a request used for editing and creating posts.
    """
    user = request.user
    content = request.POST.get("content", "") or post.content
    title = request.POST.get("title", "") or post.title
    post_type = request.POST.get("type", Post.QUESTION)

    post_type = int(post_type) if str(post_type).isdigit() else Post.QUESTION
    recaptcha_token = request.POST.get("recaptcha_response")

    # Fields found in top level posts
    tag_list = {x.strip() for x in request.POST.getlist("tag_val", [])}
    tag_val = ','.join(tag_list) or post.tag_val

    fields = dict(content=content, title=title, post_type=post_type, tag_list=tag_list, tag_val=tag_val,
                  user=user, recaptcha_token=recaptcha_token, )

    return fields
def get_fields ( request , post = None ) : user = request . user content = request . POST . get ( "content" , "" ) or post . content title = request . POST . get ( "title" , "" ) or post . title post_type = request . POST . get ( "type" , Post . QUESTION ) post_type = int ( post_type ) if str ( post_type ) . isdigit ( ) else Post . QUESTION recaptcha_token = request . POST . get ( "recaptcha_response" ) # Fields found in top level posts tag_list = { x . strip ( ) for x in request . POST . getlist ( "tag_val" , [ ] ) } tag_val = ',' . join ( tag_list ) or post . tag_val fields = dict ( content = content , title = title , post_type = post_type , tag_list = tag_list , tag_val = tag_val , user = user , recaptcha_token = recaptcha_token , ) return fields