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

Création de la vue pour une pizza.

parent 81700051
No related branches found
No related tags found
No related merge requests found
......@@ -70,7 +70,7 @@ header {
.navbar .nav-link {
height: 100%;
margin-right: .25rem;
}
.navbar .nav-link.active, .navbar .nav-link:hover {
......
{% extends 'applipizza/base.html' %}
{% load static %}
{% block title %}
Lasri Del Arte - Pizza {{ pizza }}
{% endblock %}
{% block content %}
<div class="container">
<h2>Pizza {{ pizza }}</h2>
<p>Une délicieuse pizza traditionnelle.</p>
</div>
{% endblock %}
\ No newline at end of file
......@@ -3,7 +3,7 @@
{% load static %}
{% block title %}
Pizza Corp
Lasri Del Arte - Nos pizzas
{% endblock %}
{% block content %}
......@@ -20,7 +20,7 @@
<div class="body">
<h5>{{ p.nom }}</h5>
<p>La grande classique, l’éternelle Margherita</p>
<a class="btn success" href="/pizzas/{{ p.id }}">Commander - {{ p.prix }} €</a>
<a class="btn success" href="/pizza/{{ p.id }}">Commander - {{ p.prix }} €</a>
</div>
</div>
{% endfor %}
......
from django.shortcuts import render
from applipizza.models import Pizza, Ingredient, Composition
# Create your views here.
def pizzas(request):
pizzas = Pizza.objects.all()
......@@ -9,3 +10,13 @@ def pizzas(request):
'applipizza/pizzas.html',
{'pizzas': pizzas}
)
def pizza(request, id):
pizza = Pizza.objects.get(id=id)
print(pizza)
return render(
request,
'applipizza/pizza.html',
{'pizza': pizza}
)
......@@ -20,5 +20,6 @@ from applipizza import views
urlpatterns = [
path('admin/', admin.site.urls),
path('pizzas/', views.pizzas)
path('pizzas/', views.pizzas),
path('pizza/<int:id>', views.pizza)
]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment