add a customers details page
This commit is contained in:
parent
9fec74496a
commit
368eb670e2
|
@ -17,6 +17,7 @@ class Owner(Company):
|
|||
|
||||
class Customer(Company):
|
||||
name = models.CharField(max_length=50)
|
||||
description = models.TextField()
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{% extends "inventory/base.html" %}
|
||||
{% block section_title %}{{ customer.name }}{% endblock %}
|
||||
{% block content %}
|
||||
<h3>Description</h3>
|
||||
<p>{{ customer.description }}</p>
|
||||
{% endblock %}
|
|
@ -4,7 +4,8 @@ from . import views
|
|||
|
||||
urlpatterns = [
|
||||
path('', views.CustomerList.as_view(), name='customers'),
|
||||
path('customer/<int:customer_id>/', views.ComputerList.as_view(),
|
||||
path('customer/<int:pk>/', views.CustomerDetailView.as_view(),
|
||||
name='customer'),
|
||||
name='computers'),
|
||||
path('device/<int:device_id>/', views.device_details, name='device'),
|
||||
path('computer/<int:computer_id>/', views.computer_details,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from django.contrib.auth.decorators import login_required
|
||||
from django.shortcuts import get_object_or_404, render
|
||||
from django.views.generic import ListView
|
||||
from django.views.generic import ListView, DetailView
|
||||
from guardian.shortcuts import get_objects_for_user
|
||||
from .decorators import computer_view_permission
|
||||
from .models import (Device, Computer, ComputerRamRelation,
|
||||
|
@ -33,7 +33,12 @@ def list_of_lists(request, customer_id):
|
|||
{'customer_id': customer_id})
|
||||
|
||||
|
||||
class CustomerList(ListView):
|
||||
class CustomerDetailView(DetailView):
|
||||
model = Customer
|
||||
template_name = 'inventory/customer_details.html'
|
||||
|
||||
|
||||
class CustomerListView(ListView):
|
||||
model = Customer
|
||||
template_name = 'inventory/customer_list.html'
|
||||
|
||||
|
|
Loading…
Reference in New Issue