- {% for chave, valor in nome_das_receitas.items %}
-
-
-
-
-
- {{ valor }}
-
+ {% if receitas %}
+ {% for receita in receitas %}
+
+
+
+
-
- {% endfor %}
+ {% endfor %}
+ {% else %}
+ {% endif %}
diff --git a/apps/receitas/views.py b/apps/receitas/views.py
index 2ca9994..05492c5 100644
--- a/apps/receitas/views.py
+++ b/apps/receitas/views.py
@@ -1,15 +1,8 @@
from django.shortcuts import render
+from .models import Receita
def index(request):
-
- receitas = {
- 1: 'Vitamina de Banana',
- 2: 'Nhoque de Batatinha',
- 3: 'Bolo de Cenoura'
- }
- dados = {'nome_das_receitas': receitas}
-
- return render(request, 'index.html', dados)
+ return render(request, 'index.html', {'receitas': Receita.objects.all()})
def receita(request):
return render(request, 'receita.html')