diff --git a/docs/release-notes/version-3.5.md b/docs/release-notes/version-3.5.md index 69a0b8d31..ab3031c0d 100644 --- a/docs/release-notes/version-3.5.md +++ b/docs/release-notes/version-3.5.md @@ -4,6 +4,7 @@ ### Enhancements +* [#11517](https://github.com/netbox-community/netbox/issues/11517) - Standardize the inclusion of related objects across the entire UI * [#11584](https://github.com/netbox-community/netbox/issues/11584) - Add a list view for contact assignments * [#11254](https://github.com/netbox-community/netbox/issues/11254) - Introduce the `X-Request-ID` HTTP header to annotate the unique ID of each request for change logging * [#11440](https://github.com/netbox-community/netbox/issues/11440) - Add an `enabled` field for device type interfaces diff --git a/netbox/templates/tenancy/contact.html b/netbox/templates/tenancy/contact.html index d92226137..f249a8858 100644 --- a/netbox/templates/tenancy/contact.html +++ b/netbox/templates/tenancy/contact.html @@ -67,19 +67,15 @@ Description {{ object.description|placeholder }} - - Assignments - {{ assignment_count }} - - {% include 'inc/panels/comments.html' %} + {% include 'inc/panels/tags.html' %} {% plugin_left_page object %}
+ {% include 'inc/panels/comments.html' %} {% include 'inc/panels/custom_fields.html' %} - {% include 'inc/panels/tags.html' %} {% plugin_right_page object %}
@@ -87,10 +83,10 @@
Assignments
-
- {% render_table assignments_table 'inc/table.html' %} - {% include 'inc/paginator.html' with paginator=assignments_table.paginator page=assignments_table.page %} -
+
{% plugin_full_width_page object %}
diff --git a/netbox/templates/tenancy/contactrole.html b/netbox/templates/tenancy/contactrole.html index 85b78578a..bb4802423 100644 --- a/netbox/templates/tenancy/contactrole.html +++ b/netbox/templates/tenancy/contactrole.html @@ -22,12 +22,6 @@ Description {{ object.description|placeholder }} - - Assignments - - {{ assignment_count }} - - @@ -35,19 +29,13 @@ {% plugin_left_page object %}
+ {% include 'inc/panels/related_objects.html' %} {% include 'inc/panels/custom_fields.html' %} {% plugin_right_page object %}
-
-
Assigned Contacts
-
- {% render_table contacts_table 'inc/table.html' %} - {% include 'inc/paginator.html' with paginator=contacts_table.paginator page=contacts_table.page %} -
-
{% plugin_full_width_page object %}
diff --git a/netbox/tenancy/views.py b/netbox/tenancy/views.py index b13a9c12c..b7585b8d7 100644 --- a/netbox/tenancy/views.py +++ b/netbox/tenancy/views.py @@ -255,16 +255,12 @@ class ContactRoleView(generic.ObjectView): queryset = ContactRole.objects.all() def get_extra_context(self, request, instance): - contact_assignments = ContactAssignment.objects.restrict(request.user, 'view').filter( - role=instance + related_models = ( + (ContactAssignment.objects.restrict(request.user, 'view').filter(role=instance), 'role_id'), ) - contacts_table = tables.ContactAssignmentTable(contact_assignments, user=request.user) - contacts_table.columns.hide('role') - contacts_table.configure(request) return { - 'contacts_table': contacts_table, - 'assignment_count': ContactAssignment.objects.filter(role=instance).count(), + 'related_models': related_models, } @@ -314,19 +310,6 @@ class ContactListView(generic.ObjectListView): class ContactView(generic.ObjectView): queryset = Contact.objects.all() - def get_extra_context(self, request, instance): - contact_assignments = ContactAssignment.objects.restrict(request.user, 'view').filter( - contact=instance - ) - assignments_table = tables.ContactAssignmentTable(contact_assignments, user=request.user) - assignments_table.columns.hide('contact') - assignments_table.configure(request) - - return { - 'assignments_table': assignments_table, - 'assignment_count': ContactAssignment.objects.filter(contact=instance).count(), - } - @register_model_view(Contact, 'edit') class ContactEditView(generic.ObjectEditView):