17170 Add ability to add contacts to multiple contact groups (#18885)

* 17170 Allow multiple Group assignments for Contacts

* 17170 update docs

* 17170 update api, detail view, graphql

* 17170 fixes

* 17170 fixes

* 17170 fixes

* 17170 fixes

* 17170 fixes

* 17170 fixes

* 17170 fix bulk import

* 17170 test fixes

* 17170 test fixes

* 17170 test fixes

* 17178 review changes

* 17178 review changes

* 17178 review changes

* 17178 review changes

* 17178 review changes

* 17178 review changes

* 17170 update migration

* 17170 bulk edit form
This commit is contained in:
Arthur Hanson
2025-03-18 11:05:02 -07:00
committed by GitHub
parent d4f8cb72aa
commit af5ec19430
18 changed files with 204 additions and 78 deletions

View File

@@ -46,6 +46,11 @@ class ContactGroupFilterSet(OrganizationalModelFilterSet):
to_field_name='slug',
label=_('Contact group (slug)'),
)
contact_id = django_filters.ModelMultipleChoiceFilter(
field_name='contact',
queryset=Contact.objects.all(),
label=_('Contact (ID)'),
)
class Meta:
model = ContactGroup
@@ -62,15 +67,15 @@ class ContactRoleFilterSet(OrganizationalModelFilterSet):
class ContactFilterSet(NetBoxModelFilterSet):
group_id = TreeNodeMultipleChoiceFilter(
queryset=ContactGroup.objects.all(),
field_name='group',
field_name='groups',
lookup_expr='in',
label=_('Contact group (ID)'),
)
group = TreeNodeMultipleChoiceFilter(
queryset=ContactGroup.objects.all(),
field_name='group',
lookup_expr='in',
field_name='groups',
to_field_name='slug',
lookup_expr='in',
label=_('Contact group (slug)'),
)
@@ -105,13 +110,13 @@ class ContactAssignmentFilterSet(NetBoxModelFilterSet):
)
group_id = TreeNodeMultipleChoiceFilter(
queryset=ContactGroup.objects.all(),
field_name='contact__group',
field_name='contact__groups',
lookup_expr='in',
label=_('Contact group (ID)'),
)
group = TreeNodeMultipleChoiceFilter(
queryset=ContactGroup.objects.all(),
field_name='contact__group',
field_name='contact__groups',
lookup_expr='in',
to_field_name='slug',
label=_('Contact group (slug)'),
@@ -153,7 +158,7 @@ class ContactModelFilterSet(django_filters.FilterSet):
)
contact_group = TreeNodeMultipleChoiceFilter(
queryset=ContactGroup.objects.all(),
field_name='contacts__contact__group',
field_name='contacts__contact__groups',
lookup_expr='in',
label=_('Contact group'),
)