37066-vm/core/views.py
Flatlogic Bot 7b7902f706 Simple CRM
2025-12-19 12:36:27 +00:00

27 lines
835 B
Python

from django.shortcuts import render
from django.urls import reverse_lazy
from django.views.generic import ListView, CreateView, UpdateView, DeleteView
from .models import Contact
from .forms import ContactForm
class ContactListView(ListView):
model = Contact
template_name = 'core/index.html'
context_object_name = 'contacts'
class ContactCreateView(CreateView):
model = Contact
form_class = ContactForm
template_name = 'core/contact_form.html'
success_url = reverse_lazy('index')
class ContactUpdateView(UpdateView):
model = Contact
form_class = ContactForm
template_name = 'core/contact_form.html'
success_url = reverse_lazy('index')
class ContactDeleteView(DeleteView):
model = Contact
template_name = 'core/contact_confirm_delete.html'
success_url = reverse_lazy('index')