diff --git a/7d_Proyecto_Web_Completo.md b/7d_Proyecto_Web_Completo.md index a39e66d..2ec14be 100644 --- a/7d_Proyecto_Web_Completo.md +++ b/7d_Proyecto_Web_Completo.md @@ -166,15 +166,37 @@ admin.site.register(Entrada, EntradasAdmin) **/blog/urls.py** ``` - from django.urls import path - from . import views - from django.conf import settings - from django.conf.urls.static import static + from django.shortcuts import render + from blog.models import Entrada + # Create your views here. - - urlpatterns = [ - path('', views.blog, name ='Blog'), - ] + def blog(request): + entradas = Entrada.objects.all() + return render(request, "blog/blog.html", {"entradas":entradas}) ``` - \ No newline at end of file + - #### Editar plantilla + **/blog/blog.html** + ``` + {% extends 'ProyectoWebApp/base.html' %} + {% load static %} + {% block content %} + {% for entrada in entradas %} + +
+
+
+ +
+

+ {{entrada.titulo}} + {{entrada.contenido}} +

+
+
+
+
+ {% endfor %} + {% endblock %} + ``` + \ No newline at end of file