mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Closes #7924: Include child groups on contact group view
This commit is contained in:
@ -15,6 +15,7 @@
|
|||||||
* [#7812](https://github.com/netbox-community/netbox/issues/7812) - Enable change logging for image attachments
|
* [#7812](https://github.com/netbox-community/netbox/issues/7812) - Enable change logging for image attachments
|
||||||
* [#7858](https://github.com/netbox-community/netbox/issues/7858) - Standardize the representation of content types across import & export functions
|
* [#7858](https://github.com/netbox-community/netbox/issues/7858) - Standardize the representation of content types across import & export functions
|
||||||
* [#7884](https://github.com/netbox-community/netbox/issues/7884) - Add FHRP groups column to interface tables
|
* [#7884](https://github.com/netbox-community/netbox/issues/7884) - Add FHRP groups column to interface tables
|
||||||
|
* [#7924](https://github.com/netbox-community/netbox/issues/7924) - Include child groups on contact group view
|
||||||
* [#7925](https://github.com/netbox-community/netbox/issues/7925) - Linkify contact phone and email attributes
|
* [#7925](https://github.com/netbox-community/netbox/issues/7925) - Linkify contact phone and email attributes
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
@ -50,15 +50,30 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col col-md-6">
|
<div class="col col-md-6">
|
||||||
{% include 'inc/panels/custom_fields.html' %}
|
{% include 'inc/panels/custom_fields.html' %}
|
||||||
|
<div class="card">
|
||||||
|
<h5 class="card-header">
|
||||||
|
Child Groups
|
||||||
|
</h5>
|
||||||
|
<div class="card-body">
|
||||||
|
{% include 'inc/table.html' with table=child_groups_table %}
|
||||||
|
</div>
|
||||||
|
{% if perms.tenancy.add_contactgroup %}
|
||||||
|
<div class="card-footer text-end noprint">
|
||||||
|
<a href="{% url 'tenancy:contactgroup_add' %}?parent={{ object.pk }}" class="btn btn-sm btn-primary">
|
||||||
|
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add Contact Group
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
{% plugin_right_page object %}
|
{% plugin_right_page object %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col col-md-12">
|
<div class="col col-md-12">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">
|
<h5 class="card-header">
|
||||||
Tenants
|
Contacts
|
||||||
</div>
|
</h5>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
{% include 'inc/table.html' with table=contacts_table %}
|
{% include 'inc/table.html' with table=contacts_table %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -168,6 +168,17 @@ class ContactGroupView(generic.ObjectView):
|
|||||||
queryset = ContactGroup.objects.all()
|
queryset = ContactGroup.objects.all()
|
||||||
|
|
||||||
def get_extra_context(self, request, instance):
|
def get_extra_context(self, request, instance):
|
||||||
|
child_groups = ContactGroup.objects.add_related_count(
|
||||||
|
ContactGroup.objects.all(),
|
||||||
|
Contact,
|
||||||
|
'group',
|
||||||
|
'contact_count',
|
||||||
|
cumulative=True
|
||||||
|
).restrict(request.user, 'view').filter(
|
||||||
|
parent__in=instance.get_descendants(include_self=True)
|
||||||
|
)
|
||||||
|
child_groups_table = tables.ContactGroupTable(child_groups)
|
||||||
|
|
||||||
contacts = Contact.objects.restrict(request.user, 'view').filter(
|
contacts = Contact.objects.restrict(request.user, 'view').filter(
|
||||||
group=instance
|
group=instance
|
||||||
)
|
)
|
||||||
@ -175,6 +186,7 @@ class ContactGroupView(generic.ObjectView):
|
|||||||
paginate_table(contacts_table, request)
|
paginate_table(contacts_table, request)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
'child_groups_table': child_groups_table,
|
||||||
'contacts_table': contacts_table,
|
'contacts_table': contacts_table,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user