add list of lists
this lists show all the lists related to the currently selected customer.
This commit is contained in:
parent
abba395440
commit
f8531e6014
|
@ -0,0 +1,15 @@
|
||||||
|
{% extends "inventory/base.html" %}
|
||||||
|
{% block section_title %}List of Lists{% endblock %}
|
||||||
|
{% block content %}
|
||||||
|
<table class="sortable">
|
||||||
|
<tr>
|
||||||
|
<th>Lists</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><a href="{% url 'computers' customer_id %}">Computers</a></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><a href="{% url 'devices' customer_id %}">Devices</a></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
{% endblock %}
|
|
@ -9,7 +9,8 @@ urlpatterns = [
|
||||||
path('device/<int:device_id>/', views.device_details, name='device'),
|
path('device/<int:device_id>/', views.device_details, name='device'),
|
||||||
path('computer/<int:computer_id>/', views.computer_details,
|
path('computer/<int:computer_id>/', views.computer_details,
|
||||||
name='computer'),
|
name='computer'),
|
||||||
path('devices/', views.DeviceList.as_view(), name='devices'),
|
path('devices/<int:customer_id>', views.DeviceList.as_view(),
|
||||||
|
name='devices'),
|
||||||
path('customer/<int:customer_id>/lists/', views.list_of_lists,
|
path('customer/<int:customer_id>/lists/', views.list_of_lists,
|
||||||
name='lists'),
|
name='lists'),
|
||||||
]
|
]
|
||||||
|
|
|
@ -29,7 +29,8 @@ def computer_details(request, computer_id):
|
||||||
|
|
||||||
|
|
||||||
def list_of_lists(request, customer_id):
|
def list_of_lists(request, customer_id):
|
||||||
return render(request, 'inventory/list_of_lists.html')
|
return render(request, 'inventory/list_of_lists.html',
|
||||||
|
{'customer_id': customer_id})
|
||||||
|
|
||||||
|
|
||||||
class CustomerList(ListView):
|
class CustomerList(ListView):
|
||||||
|
@ -56,3 +57,8 @@ class DeviceList(ListView):
|
||||||
model = Device
|
model = Device
|
||||||
context_object_name = 'device_list'
|
context_object_name = 'device_list'
|
||||||
template_name = 'inventory/device_list.html'
|
template_name = 'inventory/device_list.html'
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
queryset = Device.objects.filter(customer=self.kwargs['customer_id'])
|
||||||
|
return queryset
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue