mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-02 21:38:48 +00:00
36 lines
991 B
Python
36 lines
991 B
Python
from django.shortcuts import get_object_or_404
|
|
from django.http import HttpResponseRedirect
|
|
|
|
from django.views.generic import DetailView, ListView
|
|
from django.views.generic.edit import UpdateView, DeleteView, CreateView
|
|
|
|
from .models import Customer, CustomerOrder
|
|
|
|
|
|
class CustomerIndex(ListView):
|
|
model = Customer
|
|
template_name = 'customer/index.html'
|
|
context_object_name = 'customers'
|
|
|
|
def get_queryset(self):
|
|
return Customer.objects.order_by('name')
|
|
|
|
class CustomerOrderIndex(ListView):
|
|
model = CustomerOrder
|
|
template_name = 'customer/order_index.html'
|
|
context_object_name = 'orders'
|
|
|
|
|
|
class CustomerDetail(DetailView):
|
|
model = Customer
|
|
template_name = 'customer/detail.html'
|
|
queryset = Customer.objects.all()
|
|
context_object_name = 'customer'
|
|
|
|
|
|
class CustomerOrderDetail(DetailView):
|
|
model = CustomerOrder
|
|
template_name = 'customer/order_detail.html'
|
|
queryset = CustomerOrder.objects.all()
|
|
context_object_name = 'order'
|