Skip to content

Commit 065511f

Browse files
authored
Allow filtering IP addresses by family in GraphQL (#19621)
1 parent 77f0eeb commit 065511f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

netbox/ipam/graphql/filters.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,14 @@ def parent(self, value: list[str], prefix) -> Q:
159159
return Q()
160160
return q
161161

162+
@strawberry_django.filter_field()
163+
def family(
164+
self,
165+
value: Annotated['IPAddressFamilyEnum', strawberry.lazy('ipam.graphql.enums')],
166+
prefix,
167+
) -> Q:
168+
return Q(**{f"{prefix}address__family": value.value})
169+
162170

163171
@strawberry_django.filter_type(models.IPRange, lookups=True)
164172
class IPRangeFilter(ContactFilterMixin, TenancyFilterMixin, PrimaryModelFilterMixin):

0 commit comments

Comments
 (0)