Merge branch 'master' of https://forge.chapril.org/CretinsMotorisesIngenieux/Marin
This commit is contained in:
commit
a50dde5a68
3
app.py
3
app.py
|
@ -13,8 +13,7 @@ def main():
|
||||||
@app.route('/search', methods=['GET', 'POST'])
|
@app.route('/search', methods=['GET', 'POST'])
|
||||||
def search():
|
def search():
|
||||||
texte = request.form["search"]
|
texte = request.form["search"]
|
||||||
print(texte)
|
return pages.search(texte)
|
||||||
return pages.main()
|
|
||||||
|
|
||||||
@app.route('/sauveteurs/<int:idsauveteur>')
|
@app.route('/sauveteurs/<int:idsauveteur>')
|
||||||
@app.route('/sauveteur/<int:idsauveteur>')
|
@app.route('/sauveteur/<int:idsauveteur>')
|
||||||
|
|
28
pages.py
28
pages.py
|
@ -1,5 +1,6 @@
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
import definitions as lib
|
import definitions as lib
|
||||||
|
from difflib import SequenceMatcher
|
||||||
|
|
||||||
dbname = "site.db"
|
dbname = "site.db"
|
||||||
|
|
||||||
|
@ -60,3 +61,30 @@ def sauveteur(idsauveteur):
|
||||||
return render_template("sauveteur.html",**dico)
|
return render_template("sauveteur.html",**dico)
|
||||||
else:
|
else:
|
||||||
return error()
|
return error()
|
||||||
|
|
||||||
|
def search(texte):
|
||||||
|
sauveurs = lib.ex_sql(dbname,"SELECT * FROM sauveteur")
|
||||||
|
bateaux = lib.ex_sql(dbname,"SELECT * FROM bateau")
|
||||||
|
totals = sauveurs+bateaux
|
||||||
|
for i in totals:
|
||||||
|
i["score"] = 0
|
||||||
|
for key in i.keys():
|
||||||
|
if key!="score":
|
||||||
|
r = 1
|
||||||
|
if key=="nom":
|
||||||
|
r = 3
|
||||||
|
i["score"] += SequenceMatcher(None, texte, str(i[key])).ratio()*r
|
||||||
|
totals.sort(key=lambda x : x["score"])
|
||||||
|
totals.reverse()
|
||||||
|
totals = totals[:8]
|
||||||
|
results = []
|
||||||
|
for i in totals:
|
||||||
|
r = {}
|
||||||
|
if "ship_id" in i.keys():
|
||||||
|
r["lien"] = "/bateaux/"+str(i["ship_id"])
|
||||||
|
elif "personal_id" in i.keys():
|
||||||
|
r["lien"] = "/sauveteurs/"+str(i["personal_id"])
|
||||||
|
r["nom"] = i["nom"]
|
||||||
|
|
||||||
|
results.append(r)
|
||||||
|
return render_template("searchresults.html",liste=results)
|
||||||
|
|
|
@ -45,6 +45,10 @@ table, tr, td {
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#searchresults {
|
||||||
|
width: 75%;
|
||||||
|
}
|
||||||
|
|
||||||
.searchbar {
|
.searchbar {
|
||||||
float: right;
|
float: right;
|
||||||
padding-right: 20px;
|
padding-right: 20px;
|
||||||
|
|
|
@ -9,41 +9,54 @@ origine
|
||||||
histoire
|
histoire
|
||||||
!-->
|
!-->
|
||||||
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<title>{{nom}}</title>
|
|
||||||
<link href="/static/style.css" rel="stylesheet" type="text/css">
|
<title>{{nom}} - Sauveuteurs du dunkerquois</title>
|
||||||
<link rel="icon" type="image/png" href="../static/favicon.png" />
|
<link href="../static/style.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="file:///C:/Users/rugja/Marin/templates/style.css" rel="stylesheet" type="text/css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<header id="banner">
|
||||||
|
<img src="../static/icon.png" width="150" height="75">
|
||||||
|
<span id="logo_title">Sauveuteurs du dunkerquois</span>
|
||||||
|
</header>
|
||||||
|
<br>
|
||||||
|
<a href="https://www.google.com/">Proposer une modification</a>
|
||||||
|
<form class="searchbar" method=get>
|
||||||
|
<input type="text" placeholder="Saisissez votre recherche..." size=20>
|
||||||
|
<input type="submit" value="Rechercher">
|
||||||
|
</form>
|
||||||
<h1>{{nom}}}</h1>
|
<h1>{{nom}}}</h1>
|
||||||
|
<div class="flexbox">
|
||||||
|
<p>{{HistoireBateau}}</p>
|
||||||
|
<p class="right-align">
|
||||||
<table>
|
<table>
|
||||||
<tbody><tr>
|
<tbody><tr>
|
||||||
<td>Nom</td>
|
<td class="table_key">Nom</td>
|
||||||
<td>{{NomBateau}}</td>
|
<td>{{NomBateau}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Constructeur</td>
|
<td class="table_key">Constructeur</td>
|
||||||
<td>{{nom}}</td>
|
<td>{{nom}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Dimensions</td>
|
<td class="table_key">Dimensions</td>
|
||||||
<td>{{Dimensions}}</td>
|
<td>{{Dimensions}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Installation</td>
|
<td class="table_key">Installation</td>
|
||||||
<td>{{DateInstallation}}</td>
|
<td>{{Date1}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Condamnation</td>
|
<td class="table_key">Condamnation</td>
|
||||||
<td>{{DateCondamnation}}</td>
|
<td>{{Date2}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Origine</th>
|
<td class="table_key">Origine</td>
|
||||||
<th>{{ville}}</th>
|
<td>{{ville}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
</tbody></table>
|
</tbody></table>
|
||||||
<p>
|
|
||||||
{{HistoireBateau}}
|
|
||||||
</p>
|
|
||||||
|
|
||||||
|
|
||||||
</body></html>
|
</body></html>
|
||||||
|
|
|
@ -6,19 +6,29 @@ evenement
|
||||||
<!-- saved from url=(0055)file:///C:/Users/rugja/Marin/templates/bateau_temp.html -->
|
<!-- saved from url=(0055)file:///C:/Users/rugja/Marin/templates/bateau_temp.html -->
|
||||||
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
|
||||||
<title>{{siecle}}</title>
|
<title>{{siecle}}- Sauveuteurs du dunkerquois</title>
|
||||||
<link href="../static/style.css" rel="stylesheet" type="text/css">
|
<link href="../static/style.css" rel="stylesheet" type="text/css">
|
||||||
<link rel="icon" type="image/png" href="../static/favicon.png" />
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<header id="banner">
|
||||||
|
<img src="../static/icon.png" width="150" height="75">
|
||||||
|
<span id="logo_title">Sauveuteurs du dunkerquois</span>
|
||||||
|
</header>
|
||||||
|
<br>
|
||||||
|
<a href="https://www.google.com/">Proposer une modification</a>
|
||||||
|
<form class="searchbar" method=get>
|
||||||
|
<input type="text" placeholder="Saisissez votre recherche..." size=20>
|
||||||
|
<input type="submit" value="Rechercher">
|
||||||
|
</form>
|
||||||
<h1>{{siecle}}</h1>
|
<h1>{{siecle}}</h1>
|
||||||
|
<div class="flexbox">
|
||||||
<table>
|
<table>
|
||||||
<tbody><tr>
|
<tbody><tr>
|
||||||
<script> {% for i in range(Date) %}
|
<script> {% for i in range(Date) %}
|
||||||
{{ i }}
|
{{ i }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</script>
|
</script>
|
||||||
<td>Date</td>
|
<td class="table_key">Date</td>
|
||||||
<td>{{Annee}}</td>
|
<td>{{Annee}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -30,4 +40,4 @@ evenement
|
||||||
<td>{{Evenement}}</td>
|
<td>{{Evenement}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody></table>
|
</tbody></table>
|
||||||
</body></html>
|
</body></html>
|
|
@ -9,33 +9,43 @@ histoire
|
||||||
<!-- saved from url=(0055)file:///C:/Users/rugja/Marin/templates/bateau_temp.html -->
|
<!-- saved from url=(0055)file:///C:/Users/rugja/Marin/templates/bateau_temp.html -->
|
||||||
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
|
||||||
<title>{{nom}}{{prenom}}</title>
|
<title>{{nom}}{{prenom}}- Sauveuteurs du dunkerquois</title>
|
||||||
<link href="../static/style.css" rel="stylesheet" type="text/css">
|
<link href="../static/style.css" rel="stylesheet" type="text/css">
|
||||||
<link rel="icon" type="image/png" href="../static/favicon.png" />
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<header id="banner">
|
||||||
|
<img src="../static/icon.png" width="150" height="75">
|
||||||
|
<span id="logo_title">Sauveuteurs du dunkerquois</span>
|
||||||
|
</header>
|
||||||
|
<br>
|
||||||
|
<a href="https://www.google.com/">Proposer une modification</a>
|
||||||
|
<form class="searchbar" method=get>
|
||||||
|
<input type="text" placeholder="Saisissez votre recherche..." size=20>
|
||||||
|
<input type="submit" value="Rechercher">
|
||||||
|
</form>
|
||||||
<h1>{{nom}}}{{prenom}}</h1>
|
<h1>{{nom}}}{{prenom}}</h1>
|
||||||
|
<div class="flexbox">
|
||||||
|
<p>{{histoire}}</p>
|
||||||
|
<p class="right-align">
|
||||||
<table>
|
<table>
|
||||||
<tbody><tr>
|
<tbody><tr>
|
||||||
<td>Nom</td>
|
<td class="table_key">Nom</td>
|
||||||
<td>{{nom}}</td>
|
<td>{{nom}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Prenom</td>
|
<td class="table_key">Prenom</td>
|
||||||
<td>{{prenom}}</td>
|
<td>{{prenom}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Date</td>
|
<td class="table_key">Date</td>
|
||||||
<td>{{date}}</td>
|
<td>{{date}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Place</td>
|
<td class="table_key">Place</td>
|
||||||
<td>{{place}}</td>
|
<td>{{place}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody></table>
|
</tbody></table>
|
||||||
<p>
|
|
||||||
{{Histoire}}
|
|
||||||
</p>
|
|
||||||
|
|
||||||
|
|
||||||
</body></html>
|
</body></html>
|
|
@ -15,9 +15,15 @@
|
||||||
<input type="text" placeholder="Saisissez votre recherche..." size=20>
|
<input type="text" placeholder="Saisissez votre recherche..." size=20>
|
||||||
<input type="submit" value="Rechercher">
|
<input type="submit" value="Rechercher">
|
||||||
</form>
|
</form>
|
||||||
<script> {% for key, value in dres %}
|
<h1>Résultats de la recherche :</h1>
|
||||||
{{<a href=}value{>}key{</a>}}
|
<center>
|
||||||
{% endfor %}
|
<table id="searchresults">
|
||||||
</script>
|
{% for result in liste %}
|
||||||
|
<tr>
|
||||||
|
<td><a href="{{result.lien}}">{{result.nom}}</a></td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</center>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -7,19 +7,29 @@ evenement
|
||||||
<!-- saved from url=(0055)file:///C:/Users/rugja/Marin/templates/bateau_temp.html -->
|
<!-- saved from url=(0055)file:///C:/Users/rugja/Marin/templates/bateau_temp.html -->
|
||||||
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
|
||||||
<title>{{nom}}</title>
|
<title>{{nom}} - Sauveuteurs du dunkerquois</title>
|
||||||
<link href="../static/style.css" rel="stylesheet" type="text/css">
|
<link href="../static/style.css" rel="stylesheet" type="text/css">
|
||||||
<link rel="icon" type="image/png" href="../static/favicon.png" />
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<header id="banner">
|
||||||
|
<img src="../static/icon.png" width="150" height="75">
|
||||||
|
<span id="logo_title">Sauveuteurs du dunkerquois</span>
|
||||||
|
</header>
|
||||||
|
<br>
|
||||||
|
<a href="https://www.google.com/">Proposer une modification</a>
|
||||||
|
<form class="searchbar" method=get>
|
||||||
|
<input type="text" placeholder="Saisissez votre recherche..." size=20>
|
||||||
|
<input type="submit" value="Rechercher">
|
||||||
|
</form>
|
||||||
<h1>{{nom}}</h1>
|
<h1>{{nom}}</h1>
|
||||||
|
<div class="flexbox">
|
||||||
<table>
|
<table>
|
||||||
<tbody><tr>
|
<tbody><tr>
|
||||||
<script> {% for i in range(Date) %}
|
<script> {% for i in range(Date) %}
|
||||||
{{ i }}
|
{{ i }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</script>
|
</script>
|
||||||
<td>Date</td>
|
<td class="table_key">Date</td>
|
||||||
<td>{{Annee}}</td>
|
<td>{{Annee}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -31,4 +41,4 @@ evenement
|
||||||
<td>{{Evenement}}</td>
|
<td>{{Evenement}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody></table>
|
</tbody></table>
|
||||||
</body></html>
|
</body></html>
|
Loading…
Reference in New Issue