diff --git a/netbox/ipam/graphql/filters.py b/netbox/ipam/graphql/filters.py index b8326cc43ac..c0a01d72b96 100644 --- a/netbox/ipam/graphql/filters.py +++ b/netbox/ipam/graphql/filters.py @@ -101,6 +101,14 @@ def contains(self, value: list[str], prefix) -> Q: q |= Q(**{f"{prefix}prefix__net_contains": query}) return q + @strawberry_django.filter_field() + def family( + self, + value: Annotated['IPAddressFamilyEnum', strawberry.lazy('ipam.graphql.enums')], + prefix, + ) -> Q: + return Q(**{f"{prefix}prefix__family": value.value}) + @strawberry_django.filter_type(models.FHRPGroup, lookups=True) class FHRPGroupFilter(PrimaryModelFilterMixin): @@ -292,6 +300,14 @@ def contains(self, value: list[str], prefix) -> Q: q |= Q(**{f"{prefix}prefix__net_contains": query}) return q + @strawberry_django.filter_field() + def family( + self, + value: Annotated['IPAddressFamilyEnum', strawberry.lazy('ipam.graphql.enums')], + prefix, + ) -> Q: + return Q(**{f"{prefix}prefix__family": value.value}) + @strawberry_django.filter_type(models.RIR, lookups=True) class RIRFilter(OrganizationalModelFilterMixin):