Fixes #14522: Fix filtering contact assignments by group

This commit is contained in:
Jeremy Stretch
2023-12-14 16:58:11 -05:00
parent d14e4ab52b
commit 929d4d2c95
2 changed files with 84 additions and 0 deletions

View File

@@ -91,6 +91,19 @@ class ContactAssignmentFilterSet(ChangeLoggedModelFilterSet):
queryset=Contact.objects.all(),
label=_('Contact (ID)'),
)
group_id = TreeNodeMultipleChoiceFilter(
queryset=ContactGroup.objects.all(),
field_name='contact__group',
lookup_expr='in',
label=_('Contact group (ID)'),
)
group = TreeNodeMultipleChoiceFilter(
queryset=ContactGroup.objects.all(),
field_name='contact__group',
lookup_expr='in',
to_field_name='slug',
label=_('Contact group (slug)'),
)
role_id = django_filters.ModelMultipleChoiceFilter(
queryset=ContactRole.objects.all(),
label=_('Contact role (ID)'),