2023-05-20 22:42:45 +02:00
|
|
|
from django.shortcuts import render
|
2023-05-21 18:50:15 +02:00
|
|
|
from django.views.generic.list import ListView
|
2023-05-21 19:21:17 +02:00
|
|
|
from django.views.generic.detail import DetailView
|
2023-05-22 20:52:18 +02:00
|
|
|
from django.views.generic.edit import CreateView, UpdateView, DeleteView
|
2023-05-21 21:33:13 +02:00
|
|
|
from django.urls import reverse_lazy
|
2023-05-21 18:50:15 +02:00
|
|
|
from .models import Tarea
|
2023-05-20 22:42:45 +02:00
|
|
|
|
|
|
|
# Create your views here.
|
|
|
|
|
|
|
|
|
2023-05-21 18:50:15 +02:00
|
|
|
class ListaPendientes(ListView):
|
|
|
|
model = Tarea
|
|
|
|
context_object_name = 'tareas'
|
2023-05-21 19:21:17 +02:00
|
|
|
|
|
|
|
|
|
|
|
class DetalleTarea(DetailView):
|
|
|
|
model = Tarea
|
|
|
|
context_object_name = 'tarea'
|
|
|
|
template_name = 'base/tarea.html'
|
2023-05-21 21:33:13 +02:00
|
|
|
|
|
|
|
|
|
|
|
class CrearTarea(CreateView):
|
|
|
|
model = Tarea
|
|
|
|
fields = '__all__'
|
|
|
|
success_url = reverse_lazy('tareas')
|
2023-05-22 20:35:48 +02:00
|
|
|
|
|
|
|
|
|
|
|
class EditarTarea(UpdateView):
|
|
|
|
model = Tarea
|
|
|
|
fields = '__all__'
|
|
|
|
success_url = reverse_lazy('tareas')
|
2023-05-22 20:52:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
class EliminarTarea(DeleteView):
|
|
|
|
model = Tarea
|
|
|
|
context_object_name = 'tarea'
|
|
|
|
success_url = reverse_lazy('tareas')
|