Renamed URLs for /customer/

This commit is contained in:
Oliver 2018-04-17 23:56:25 +10:00
parent 8b1dbd4500
commit 3f33a921ae
8 changed files with 81 additions and 8 deletions

View File

@ -13,7 +13,7 @@ from supplier.urls import supplier_urls
from build.urls import build_urls
from customer.urls import customer_orders_urls
from customer.urls import customer_urls
from django.conf import settings
from django.conf.urls.static import static
@ -73,7 +73,7 @@ urlpatterns = [
url(r'^stock/', include(stock_urls)),
url(r'^supplier/', include(supplier_urls)),
url(r'^build/', include(build_urls)),
url(r'^customer-orders/', include(customer_orders_urls)),
url(r'^customer/', include(customer_urls)),
url(r'^admin/', admin.site.urls),
url(r'^auth/', include('rest_framework.urls', namespace='rest_framework')),

View File

@ -0,0 +1,5 @@
{% extends "base.html" %}
{% block content %}
{% endblock %}

View File

@ -0,0 +1,5 @@
{% extends "base.html" %}
{% block content %}
{% endblock %}

View File

@ -2,8 +2,45 @@ from django.conf.urls import url, include
from . import views
# URL list for customer orders web interface
customer_detail_urls = [
# url(r'^edit/?', views.CustomerEdit.as_view(), name='customer-edit'),
# url(r'^delete/?', views.CustomerDelete.as_view(), name='customer-delete'),
# Everything else
url(r'^.*$', views.CustomerDetail.as_view(), name='customer-detail'),
]
customer_order_detail_urls = [
# url(r'^edit/?', views.CustomerOrderEdit.as_view(), name='customer-order-edit'),
# url(r'^delete/?', views.CustomerOrderDelete.as_view(), name='customer-order-delete'),
# Everything else
url(r'^.*$', views.CustomerOrderDetail.as_view(), name='customer-order-detail'),
]
customer_orders_urls = [
# Top level order list
# Details of a specific order
# Details of an individual customer
url(r'^(?P<pk>[0-9]+)/', include(customer_order_detail_urls)),
# Create a new customer order
# url(r'new/?', views.CustomerOrderCreate.as_view(), name='customer-order-create'),
# Everything else
url(r'^.*$', views.CustomerOrderIndex.as_view(), name='customer-order-index'),
]
]
# URL list for customer orders web interface
customer_urls = [
# Customer orders (CSO)
url(r'^order/', include(customer_orders_urls)),
# Details of an individual customer
url(r'^(?P<pk>[0-9]+)/', include(customer_detail_urls)),
# url(r'new/?', views.CustomerCreate.as_view(), name='customer-create'),
# Top level order list
url(r'^.*$', views.CustomerIndex.as_view(), name='customer-index'),
]

View File

@ -1,8 +1,33 @@
from django.views.generic import DetailView, ListView
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_obect_name = 'customers'
from .models import CustomerOrder
class CustomerOrderIndex(ListView):
model = CustomerOrder
template_name = 'customer_orders/index.html'
template_name = 'customer/order_index.html'
context_object_name = 'customer_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'

View File

@ -7,6 +7,7 @@ from crispy_forms.layout import Submit
from .models import StockLocation, StockItem
class EditStockLocationForm(forms.ModelForm):
def __init__(self, *args, **kwargs):