def detailsThread(request):#GET
    cursor = connection.cursor()

    idThread = int(request.GET["thread"])
    related = request.GET.getlist("related",[])#Possible values: ['user', 'forum']

    thread = getThreadById(cursor,idThread)[0]

    checking3 = set(related)-set(['user', 'forum'])
    if checking3:
        return HttpResponse(responseErrorCode(3,"thread can not be in related"),content_type="application/json")

    if 'user' in related:
        user = getUserByEmail(cursor,thread['user'])[0]
        thread.update({'user': user})

    if 'forum' in related:
        forum = getForumByShortName(cursor,thread['forum'])[0]
        thread.update({'forum': forum})

    code = 0
    response = { "code": code, "response": thread}
    response = json.dumps(response)
    cursor.close()
    return HttpResponse(response,content_type="application/json")
def detailsPost(request):
    cursor = connection.cursor()
    idPost = int(request.GET["post"])
    related = request.GET.getlist("related",[])#['user', 'thread', 'forum']
    post = getPostById(cursor,idPost)
    if not post:
        return HttpResponse(responseErrorCode(1,"error id is not exist"),content_type="application/json")
    post = post[0]

    if 'user' in related:
        user = getUserByEmail(cursor,post['user'])
        post.update({'user':user[0]})
    
    if 'thread' in related:
        thread = getThreadById(cursor,post['thread'])
        post.update({'thread':thread[0]})

    if 'forum' in related:
        forum = getForumByShortName(cursor,post['forum'])
        post.update({'forum':forum[0]})

    code = 0
    response = { "code": code, "response": post }
    response = json.dumps(response)
    cursor.close()
    return HttpResponse(response,content_type="application/json")