Ajout de la page web bateau
This commit is contained in:
parent
4c550380b6
commit
9b0d08ca29
6
app.py
6
app.py
@ -11,9 +11,15 @@ def main():
|
||||
return pages.main()
|
||||
|
||||
@app.route('/sauveteurs/<int:idsauveteur>')
|
||||
@app.route('/sauveteur/<int:idsauveteur>')
|
||||
def sauveteur(idsauveteur):
|
||||
return pages.sauveteur(idsauveteur)
|
||||
|
||||
@app.route('/bateaux/<int:idbateau>')
|
||||
@app.route('/bateau/<int:idbateau>')
|
||||
def bateau(idbateau):
|
||||
return pages.bateau(idbateau)
|
||||
|
||||
@app.errorhandler(404)
|
||||
def error(e):
|
||||
return pages.error()
|
||||
|
33
pages.py
33
pages.py
@ -11,6 +11,27 @@ def main():
|
||||
def error():
|
||||
return render_template("error.html")
|
||||
|
||||
def bateau(idbateau):
|
||||
dico = {}
|
||||
dico["NomBateau"] = "Le Bateau"
|
||||
dico["nom"] = "Le constructeur"
|
||||
dico["Dimensions"] = 666
|
||||
dico["DateInstallation"] = "Aujourd'hui"
|
||||
dico["DateCondamnation"] = "Demain"
|
||||
dico["ville"] = "ici"
|
||||
dico["HistoireBateau"] = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam at odio cursus, rutrum odio non, dignissim risus. Pellentesque non varius ante. Vivamus scelerisque pulvinar mauris, nec imperdiet ante mattis et."
|
||||
result = lib.ex_sql(dbname,"SELECT * FROM bateau WHERE ship_id=?",(idbateau,))
|
||||
if len(result)>=1:
|
||||
result = result[0]
|
||||
dico["nom"] = result["nom"]
|
||||
print(result)
|
||||
dico["Dimensions"] = result["dimension"]
|
||||
dico["DateInstallation"] = result["date_naissance"]
|
||||
dico["DateCondamnation"] = result["date_mort"]
|
||||
return render_template("sauveteur.html",**dico)
|
||||
else:
|
||||
return error()
|
||||
|
||||
def sauveteur(idsauveteur):
|
||||
dico = {}
|
||||
dico["nom"] = "John"
|
||||
@ -19,7 +40,11 @@ def sauveteur(idsauveteur):
|
||||
dico["nb_sauves"] = 666
|
||||
dico["gratifications"] = 1
|
||||
dico["description"] = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam at odio cursus, rutrum odio non, dignissim risus. Pellentesque non varius ante. Vivamus scelerisque pulvinar mauris, nec imperdiet ante mattis et."
|
||||
result = lib.ex_sql(dbname,"SELECT * FROM sauveteur WHERE personal_id=?",(idsauveteur,))[0]
|
||||
dico["nom"] = result["nom"]
|
||||
dico["prenom"] = result["prenom"]
|
||||
return render_template("sauveteur.html",**dico)
|
||||
result = lib.ex_sql(dbname,"SELECT * FROM sauveteur WHERE personal_id=?",(idsauveteur,))
|
||||
if len(result)==1:
|
||||
result = result[0]
|
||||
dico["nom"] = result["nom"]
|
||||
dico["prenom"] = result["prenom"]
|
||||
return render_template("sauveteur.html",**dico)
|
||||
else:
|
||||
return error()
|
||||
|
@ -9,10 +9,8 @@ origine
|
||||
histoire
|
||||
!-->
|
||||
<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">
|
||||
<link href="file:///C:/Users/rugja/Marin/templates/style.css" rel="stylesheet" type="text/css">
|
||||
<link href="/static/style.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>{{nom}}}</h1>
|
||||
@ -31,33 +29,11 @@ histoire
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Installation</td>
|
||||
<td>{{Date}}</td>
|
||||
<td>{{DateInstallation}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Condamnation</td>
|
||||
<td>{{Date}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Origine</td>
|
||||
<td>{{ville}}</td>
|
||||
<th>Nom</th>
|
||||
<th>{{NomBateau}}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Constructeur</th>
|
||||
<th>{{nom}}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Dimensions</th>
|
||||
<th>{{Dimensions}}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Installation</th>
|
||||
<th>{{Date}}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Condamnation</th>
|
||||
<th>{{Date}}</th>
|
||||
<td>{{DateCondamnation}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Origine</th>
|
||||
|
Loading…
Reference in New Issue
Block a user