diff --git a/netbox/ipam/graphql/filters.py b/netbox/ipam/graphql/filters.py index 50509d6a2b..0d34638412 100644 --- a/netbox/ipam/graphql/filters.py +++ b/netbox/ipam/graphql/filters.py @@ -85,6 +85,14 @@ class AggregateFilter(ContactFilterMixin, TenancyFilterMixin, PrimaryModelFilter rir_id: ID | None = strawberry_django.filter_field() date_added: DateFilterLookup[date] | None = strawberry_django.filter_field() + @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): @@ -261,6 +269,14 @@ def contains(self, value: list[str], prefix) -> Q: q |= Q(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):