34 lines
1022 B
Python
34 lines
1022 B
Python
from django.views.generic import ListView, DetailView, CreateView, UpdateView, DeleteView
|
|
from django.urls import reverse_lazy
|
|
from .models import Cliente
|
|
|
|
class IndexView(ListView):
|
|
model = Cliente
|
|
template_name = "core/index.html"
|
|
context_object_name = "clienti"
|
|
|
|
class ClienteListView(ListView):
|
|
model = Cliente
|
|
template_name = "core/cliente_list.html"
|
|
context_object_name = "clienti"
|
|
|
|
class ClienteDetailView(DetailView):
|
|
model = Cliente
|
|
template_name = "core/cliente_detail.html"
|
|
|
|
class ClienteCreateView(CreateView):
|
|
model = Cliente
|
|
fields = '__all__'
|
|
template_name = "core/cliente_form.html"
|
|
success_url = reverse_lazy('cliente_list')
|
|
|
|
class ClienteUpdateView(UpdateView):
|
|
model = Cliente
|
|
fields = '__all__'
|
|
template_name = "core/cliente_form.html"
|
|
success_url = reverse_lazy('cliente_list')
|
|
|
|
class ClienteDeleteView(DeleteView):
|
|
model = Cliente
|
|
template_name = "core/cliente_confirm_delete.html"
|
|
success_url = reverse_lazy('cliente_list') |