This commit is contained in:
batikano1 2021-12-03 06:34:18 +01:00
commit b518224831
5 changed files with 13 additions and 10 deletions

Binary file not shown.

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from flask import render_template from flask import render_template
import definitions as lib import definitions as lib
from difflib import SequenceMatcher from difflib import SequenceMatcher
@ -31,6 +30,7 @@ def bateau(idbateau):
dico["date_naissance"] = result["date_naissance"] dico["date_naissance"] = result["date_naissance"]
dico["date_mort"] = result["date_mort"] dico["date_mort"] = result["date_mort"]
dico["Histoire"] = result["histoire"] dico["Histoire"] = result["histoire"]
dico["dimensions"] = result["dimension"]
return render_template("bateau.html",**dico) return render_template("bateau.html",**dico)
else: else:
return error() return error()
@ -69,6 +69,7 @@ def sauveteur(idsauveteur):
dico["prenom"] = result["prenom"] dico["prenom"] = result["prenom"]
dico["date_naissance"] = result["date_naissance"] dico["date_naissance"] = result["date_naissance"]
dico["date_deces"] = result["date_mort"] dico["date_deces"] = result["date_mort"]
dico["description"] = result["description"]
print(dico["naissance"]) print(dico["naissance"])
print(dico["deces"]) print(dico["deces"])
ids = lib.ex_sql(dbname,"SELECT * FROM mission WHERE personal_id=?",(idsauveteur,)) ids = lib.ex_sql(dbname,"SELECT * FROM mission WHERE personal_id=?",(idsauveteur,))
@ -85,7 +86,8 @@ def sauveteur(idsauveteur):
def search(texte): def search(texte):
sauveurs = lib.ex_sql(dbname,"SELECT * FROM sauveteur") sauveurs = lib.ex_sql(dbname,"SELECT * FROM sauveteur")
bateaux = lib.ex_sql(dbname,"SELECT * FROM bateau") bateaux = lib.ex_sql(dbname,"SELECT * FROM bateau")
totals = sauveurs+bateaux expeditions = lib.ex_sql(dbname,"SELECT * FROM expedition")
totals = sauveurs+bateaux+expeditions
for i in totals: for i in totals:
i["score"] = 0 i["score"] = 0
for key in i.keys(): for key in i.keys():
@ -103,9 +105,14 @@ def search(texte):
r = {} r = {}
if "ship_id" in i.keys(): if "ship_id" in i.keys():
r["lien"] = "/bateaux/"+str(i["ship_id"]) r["lien"] = "/bateaux/"+str(i["ship_id"])
n = "Bateau"
elif "personal_id" in i.keys(): elif "personal_id" in i.keys():
r["lien"] = "/sauveteurs/"+str(i["personal_id"]) r["lien"] = "/sauveteurs/"+str(i["personal_id"])
r["nom"] = i["nom"] n = "Sauveteurs"
elif "expedition_id" in i.keys():
r["lien"] = "/expeditions/"+str(i["expedition_id"])
n = "Expeditions"
r["nom"] = i["nom"]+" - "+n
results.append(r) results.append(r)
return render_template("searchresults.html",liste=results) return render_template("searchresults.html",liste=results)

BIN
pages.pyc

Binary file not shown.

View File

@ -28,6 +28,9 @@
<tr> <tr>
<td class="table_key">Mise en arrêt</td><td>{{date_mort}}</td> <td class="table_key">Mise en arrêt</td><td>{{date_mort}}</td>
</tr> </tr>
<tr>
<td class="table_key">Dimensions</td><td>{{dimensions}}</td>
</tr>
</table> </table>
</p> </p>
</div> </div>

View File

@ -5,11 +5,4 @@
</head> </head>
<body> <body>
{% include 'header.html' %} {% include 'header.html' %}
<br>
<center>
<br>
<div>
<button action="/random">Page au hasard</button>
</div>
</center>
</body> </body>