fix: Search field

pull/12/head
Raphaël Vinot 2018-04-11 16:16:19 +02:00
parent 823a83a9cd
commit 5e0f198836
2 changed files with 8 additions and 4 deletions

View File

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
from flask import Flask, render_template
from flask import Flask, render_template, request
from flask_bootstrap import Bootstrap
from bgpranking.querying import Querying
@ -22,8 +22,12 @@ def index():
return render_template('index.html', ranks=ranks)
@app.route('/asn/<int:asn>', methods=['GET'])
def asn_details(asn):
@app.route('/asn', methods=['GET', 'POST'])
def asn_details():
q = Querying()
if request.method == 'POST':
asn = request.form['asn']
if request.method == 'GET':
asn = request.args['asn']
ranks = q.asn_details(asn)
return render_template('asn.html', asn=asn, ranks=ranks)

View File

@ -6,7 +6,7 @@
<center>
<h1>BGP Ranking</h1></br></br>
</center>
<form action="{{ url_for('asn_details', asn=asn) }}" method=get>
<form action="{{ url_for('asn_details') }}" method=post>
ASN to search: <input type=number name=asn>
<input type="submit" value="Search">
</form>