Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @app.route('/search/<int:idno>', methods=['GET', 'POST']) #change here
- def search(idno):
- results = []
- search_string = request.form['search']
- if request.form['search'] == '':
- qry = db_session.query(idno)
- results = qry.all()
- if not results:
- flash('ID not found !')
- return redirect('/')
- else:
- # display results
- return render_template('success.html', results=results)
- <div class="search">
- <form method="POST"> # change here remove action
- <input type=text name=search value="{{ request.form.search}}"></br>
- <div class="actions"><input type=submit value="Search"></div>
- </form>
- </div>
- {% for message in get_flashed_messages() %}
- <div class=flash>
- {{ message }}
- </div>
- {% endfor%}
- {% endblock%}
Add Comment
Please, Sign In to add comment