add a link to users to the customer_table_view

This commit is contained in:
Andreas Zweili 2019-12-30 11:00:15 +01:00
parent fd4b0564d4
commit cfb452e55e
4 changed files with 23 additions and 2 deletions

View File

@ -10,6 +10,7 @@ class CustomersTable(tables.Table):
devices = tables.LinkColumn('devices', text='Devices', args=[A('pk')])
backups = tables.LinkColumn('backups', text='Backups', args=[A('pk')])
licenses = tables.LinkColumn('licenses', text='Licenses', args=[A('pk')])
users = tables.LinkColumn('users', text='Users', args=[A('pk')])
class Meta:
template_name = 'django_tables2/semantic.html'

View File

@ -54,7 +54,11 @@ def test_customer_list_view(create_admin_user):
and helper.in_content(response,
"/customer/"
+ str(customer.id)
+ "/licenses/"))
+ "/licenses/")
and helper.in_content(response,
"/customer/"
+ str(customer.id)
+ "/users/"))
def test_customer_list_view_multiple_customers(create_admin_user):
@ -87,6 +91,10 @@ def test_customer_list_view_multiple_customers(create_admin_user):
"/customer/"
+ str(customer1.id)
+ "/licenses/")
and helper.in_content(response,
"/customer/"
+ str(customer1.id)
+ "/users/")
and helper.in_content(response, customer2)
and helper.in_content(response,
"/customer/"
@ -107,5 +115,9 @@ def test_customer_list_view_multiple_customers(create_admin_user):
and helper.in_content(response,
"/customer/"
+ str(customer2.id)
+ "/licenses/"))
+ "/licenses/")
and helper.in_content(response,
"/customer/"
+ str(customer1.id)
+ "/users/"))

View File

@ -24,4 +24,6 @@ urlpatterns = [
name='all_computers'),
path('customer/<int:pk>/licenses/', views.licenses_table_view,
name='licenses'),
path('customer/<int:pk>/users/', views.users_table_view,
name='users'),
]

View File

@ -146,3 +146,9 @@ def licenses_table_view(request, pk):
RequestConfig(request).configure(computer_licenses)
return render(request, 'inventory/license_list.html', {'user_licenses': user_licenses,
'computer_licenses': computer_licenses})
@login_required
@customer_view_permission
def users_table_view(request, pk):
pass