Curso-lenguaje-python/python-total/dia_16/mi_web/src/proyecto/base/views.py

26 lines
599 B
Python
Raw Normal View History

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.
class ListaPendientes(ListView):
model = Tarea
context_object_name = 'tareas'
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')