创新实训记录7--实现跳转逻辑(实现输入论文名,查询论文的相关信息)

实现输入论文名,查询论文的相关信息:
创新实训记录7--实现跳转逻辑(实现输入论文名,查询论文的相关信息)_第1张图片
创新实训记录7--实现跳转逻辑(实现输入论文名,查询论文的相关信息)_第2张图片

代码:
views.py文件:

def choose_detail(request):
    node= request.POST['node']
    artical=""
    author=""
    abstract=""
    affiliation=""
    IndexTerm=""
    keyword=""
    inlink=""
    outlink=""
    GeneralTerm=""
    num=0
    kk=""
    with open('choose_paper/data/nodes2.txt','r',encoding='utf-8') as f:
        line=f.readlines()
        for j in range(len(line)):
            line=line[j].split() 
            node_sp=node.split()          
            flag=False
            if(len(node_sp)==(len(line)-1)):
                for i in range(len(node_sp)):
                    if(node_sp[i]!=line[i+1]):
                        flag=False
                        break
                    else:
                        flag=True
            if flag==True:
                artical=line[0]
                num=j
                break
    with open('choose_paper/data/abstracts.txt','r',encoding='utf-8') as f:
        lines=f.readlines()
        abstract=lines[num]
    with open('choose_paper/data/affiliations.txt','r',encoding='utf-8') as f:
        lines=f.readlines()
        affiliation=lines[num]
    with open('choose_paper/data/articles.txt','r',encoding='utf-8') as f:
        lines=f.readlines()
        artical=lines[num]
    with open('choose_paper/data/authors.txt','r',encoding='utf-8') as f:
        lines=f.readlines()
        author=lines[num]
    with open('choose_paper/data/GeneralTerms.txt','r',encoding='utf-8') as f:
        lines=f.readlines()
        GeneralTerm=lines[num]
    with open('choose_paper/data/IndexTerms.txt','r',encoding='utf-8') as f:
        lines=f.readlines()
        IndexTerm=lines[num]
    with open('choose_paper/data/inlinks_nodes.txt','r',encoding='utf-8') as f:
        lines=f.readlines()
        inlink=lines[num]
    with open('choose_paper/data/keywords.txt','r',encoding='utf-8') as f:
        lines=f.readlines()
        keyword=lines[num]
    with open('choose_paper/data/outlinks_nodes.txt','r',encoding='utf-8') as f:
        lines=f.readlines()
        outlink=lines[num]
        # kk=abstract
    context = {
        'articals': artical,
        'authors ': author,
        'abstracts': abstract,
        'affiliations': affiliation,
        'IndexTerms ': IndexTerm,
        'keywords': keyword,
        'nodes': node,
        'inlinks': inlink,
        'outlinks':outlink,
        'GeneralTerms': GeneralTerm,
    }
    return render(request, 'choose_paper/paper_detail.html', context)

你可能感兴趣的:(创新实训记录7--实现跳转逻辑(实现输入论文名,查询论文的相关信息))