mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Include action buttons on contact assignments table
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
{% extends 'generic/object.html' %}
|
||||
{% load helpers %}
|
||||
{% load plugins %}
|
||||
{% load render_table from django_tables2 %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
{{ block.super }}
|
||||
@ -69,10 +70,14 @@
|
||||
<div class="card">
|
||||
<h5 class="card-header">Assignments</h5>
|
||||
<div class="card-body">
|
||||
{% include 'inc/table.html' with table=contacts_table %}
|
||||
{% if assignments_table.rows %}
|
||||
{% render_table assignments_table 'inc/table.html' %}
|
||||
{% else %}
|
||||
<div class="text-muted">None</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% include 'inc/paginator.html' with paginator=contacts_table.paginator page=contacts_table.page %}
|
||||
{% include 'inc/paginator.html' with paginator=assignments_table.paginator page=assignments_table.page %}
|
||||
{% plugin_full_width_page object %}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -160,8 +160,12 @@ class ContactAssignmentTable(BaseTable):
|
||||
role = tables.Column(
|
||||
linkify=True
|
||||
)
|
||||
actions = ButtonsColumn(
|
||||
model=ContactAssignment,
|
||||
buttons=('edit', 'delete')
|
||||
)
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
model = ContactAssignment
|
||||
fields = ('pk', 'content_type', 'object', 'contact', 'role', 'priority')
|
||||
default_columns = ('pk', 'object', 'contact', 'role', 'priority')
|
||||
fields = ('pk', 'content_type', 'object', 'contact', 'role', 'priority', 'actions')
|
||||
default_columns = ('pk', 'content_type', 'object', 'contact', 'role', 'priority', 'actions')
|
||||
|
@ -293,12 +293,12 @@ class ContactView(generic.ObjectView):
|
||||
contact_assignments = ContactAssignment.objects.restrict(request.user, 'view').filter(
|
||||
contact=instance
|
||||
)
|
||||
contacts_table = tables.ContactAssignmentTable(contact_assignments)
|
||||
contacts_table.columns.hide('contact')
|
||||
paginate_table(contacts_table, request)
|
||||
assignments_table = tables.ContactAssignmentTable(contact_assignments)
|
||||
assignments_table.columns.hide('contact')
|
||||
paginate_table(assignments_table, request)
|
||||
|
||||
return {
|
||||
'contacts_table': contacts_table,
|
||||
'assignments_table': assignments_table,
|
||||
'assignment_count': ContactAssignment.objects.filter(contact=instance).count(),
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user