Update day 16

Signed-off-by: Manuel Vergara <manuel@vergaracarmona.es>
This commit is contained in:
2023-05-21 18:50:15 +02:00
parent d795c56835
commit 15ae6ed3da
8 changed files with 126 additions and 6 deletions

View File

@@ -0,0 +1,19 @@
<h1>Lista de pendientes</h1>
<table>
<tr>
<th>Elementos</th>
</tr>
{% for tarea in tareas %}
<tr>
<td>{{ tarea.titulo }}</td>
</tr>
{% empty %}
<h3>No hay elementos en esta lista</h3>
{% endfor %}
</table>

View File

@@ -1,7 +1,7 @@
from django.urls import path
from . import views
from .views import ListaPendientes
urlpatterns = [
path('', views.lista_pendientes, name='pendientes')
path('', ListaPendientes.as_view(), name='pendientes')
]

View File

@@ -1,8 +1,10 @@
from django.shortcuts import render
from django.http import HttpResponse
from django.views.generic.list import ListView
from .models import Tarea
# Create your views here.
def lista_pendientes(pedido):
return HttpResponse('Lista de pendientes')
class ListaPendientes(ListView):
model = Tarea
context_object_name = 'tareas'

View File

@@ -55,7 +55,7 @@ ROOT_URLCONF = 'proyecto.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'DIRS': ['../base/templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [