修复搜索框内查询
This commit is contained in:
parent
596bead678
commit
16faed70ce
15
web/main.py
15
web/main.py
@ -6,7 +6,8 @@ from ml.Search import Search
|
||||
render = web.template.render('templates/')
|
||||
|
||||
urls=(
|
||||
'/(.*)','index'
|
||||
"/","index",
|
||||
"/news","news"
|
||||
)
|
||||
|
||||
app = web.application(urls,globals())
|
||||
@ -14,13 +15,19 @@ app = web.application(urls,globals())
|
||||
class index:
|
||||
def __init__(self):
|
||||
self.se = Search()
|
||||
def GET(self,searchword):
|
||||
def GET(self):
|
||||
searchword = web.input().searchword
|
||||
newslist=list()
|
||||
if searchword:
|
||||
newslist = self.se.QueryPhrase(searchword,False)
|
||||
return render.header(searchword,newslist)
|
||||
def POST(self):
|
||||
searchword = web.input(searchword=[])
|
||||
|
||||
class news:
|
||||
def __init__(self):
|
||||
self.se = Search()
|
||||
def GET(self):
|
||||
searchword = web.input().searchword
|
||||
newslist=list()
|
||||
if searchword:
|
||||
newslist = self.se.QueryPhrase(searchword,False)
|
||||
return render.header(searchword,newslist)
|
||||
|
BIN
web/main.pyc
BIN
web/main.pyc
Binary file not shown.
@ -13,11 +13,9 @@ $def with(searchword,newslist)
|
||||
<form class="bs-example bs-example-form" role="form">
|
||||
<div class="col-lg-8">
|
||||
<div class="input-group">
|
||||
<input type="text" name="searchword" class="form-control" placeholder=$searchword>
|
||||
<input type="text" class="form-control" name="searchword" placeholder=$searchword>
|
||||
<span class="input-group-btn">
|
||||
<button type="submit" class="btn btn-default" type="button">
|
||||
搜索
|
||||
</button>
|
||||
<button class="btn btn-default" type="button">搜索</button>
|
||||
</span>
|
||||
</div><!-- /input-group -->
|
||||
</div><!-- /.col-lg-6 -->
|
||||
|
Loading…
Reference in New Issue
Block a user