Update day 16

Signed-off-by: Manuel Vergara <manuel@vergaracarmona.es>
This commit is contained in:
2023-05-21 21:33:13 +02:00
parent 10e318cdc5
commit 9c43d3cad5
6 changed files with 67 additions and 3 deletions

View File

@@ -0,0 +1,2 @@
<h1>Formulario de tareas</h1>

View File

@@ -1,5 +1,7 @@
<h1>Lista de pendientes</h1>
<a href="{% url 'crear-tarea' %}">Crear nueva tarea</a>
<table>
<tr>
<th>Elementos</th>

View File

@@ -1,8 +1,9 @@
from django.urls import path
from .views import ListaPendientes, DetalleTarea
from .views import ListaPendientes, DetalleTarea, CrearTarea
urlpatterns = [
path('', ListaPendientes.as_view(), name='pendientes'),
path('tarea/<int:pk>', DetalleTarea.as_view(), name='tarea')
path('tarea/<int:pk>', DetalleTarea.as_view(), name='tarea'),
path('crear-tarea/', CrearTarea.as_view(), name='crear-tarea')
]

View File

@@ -1,6 +1,8 @@
from django.shortcuts import render
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView
from django.urls import reverse_lazy
from .models import Tarea
# Create your views here.
@@ -15,3 +17,9 @@ class DetalleTarea(DetailView):
model = Tarea
context_object_name = 'tarea'
template_name = 'base/tarea.html'
class CrearTarea(CreateView):
model = Tarea
fields = '__all__'
success_url = reverse_lazy('tareas')