Skip to content
Snippets Groups Projects
Commit 481f5a7b authored by Sofiane Lasri's avatar Sofiane Lasri
Browse files

TP3 terminé

parent 3365b168
No related branches found
No related tags found
No related merge requests found
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>Les pizzas</title>
</head>
<body>
<header>
<nav>
<div>
<a href="/pizzas/">Les pizzas</a>
</div>
<div>
<a href="/ingredients/">Les ingrédients</a>
</div>
</nav>
</header>
<main>
<h2>Voici nos {{ pizzas|length }} pizzas</h2>
<ul>
{% for p in pizzas %}
<li>
<a href="/pizzas/{{ p.id }}">{{ p.nom }} </a> - {{ p.prix }} €
</li>
{% endfor %}
</ul>
</main>
<footer>
<p>© Pizza Corp - Tous droits réservés</p>
</footer>
</body>
</html>
\ No newline at end of file
from django.shortcuts import render
from applipizza.models import Pizza, Ingredient, Composition
# Create your views here.
def pizzas(request):
pizzas = Pizza.objects.all()
return render(
request,
'applipizza/pizzas.html',
{'pizzas': pizzas}
)
\ No newline at end of file
......@@ -16,7 +16,9 @@ Including another URLconf
"""
from django.contrib import admin
from django.urls import path
from applipizza import views
urlpatterns = [
path('admin/', admin.site.urls),
path('pizzas/', views.pizzas)
]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment